I tried what you suggested but it still has the same problem. Although the line
let custlist = try Customers.fetchAll(db)
sets custlist to an array the type swift uses is type 'Customers'
Below is the section of code for Customers if that helps any?
Do you see how to fix it now?
Thanks
import Foundation
import GRDB
struct Customers {
var id: Int64?
var CustNumber: String?
var CustName: String?
var CustAddr: String?
var CustCity: String?
var CustState: String?
var CustZip: String?
var CustMobile: String?
var CustEmail: String?
var CustNotes: String?
var CustAdded: Date?
}
extension Customers: Codable, FetchableRecord, MutablePersistableRecord {
mutating func didInsert(with rowID: Int64, for column: String?) {
id = rowID
}
}
extension Customers {
private enum Columns {
static let id = Column(CodingKeys.id)
static let CustName = Column(CodingKeys.CustName)
static let CustAddr = Column(CodingKeys.CustAddr)
static let CustCity = Column(CodingKeys.CustCity)
static let CustZip = Column(CodingKeys.CustZip)
static let CustMobile = Column(CodingKeys.CustMobile)
static let CustEmail = Column(CodingKeys.CustEmail)
static let CustNotes = Column(CodingKeys.CustNotes)
static let CustAdded = Column(CodingKeys.CustAdded)
}
}