Hi! I'm very new to swift and I was having an issue with using data from a data model.
struct Orchard: Identifiable {
var id = UUID()
var title: String
var category: String
var year: String
var itemID: Int
var imageName: String
var bannerName: String
}
let orchardData: [Orchard] = [
Orchard(title: "iPhone 12", category: "iPhone", year: "2020", itemID: 1001, imageName: "iphone_12", bannerName: "iphone_12_wallpaper"),
Orchard(title: "iPhone 12 Pro", category: "iPhone", year: "2020", itemID: 1002, imageName: "iphone_12_pro", bannerName: "iphone_12_pro_wallpaper"),
Orchard(title: "iPhone 11", category: "iPhone", year: "2019", itemID: 1003, imageName: "iphone_11", bannerName: "iphone_11_wallpaper"),
Orchard(title: "iPhone 11 Pro", category: "iPhone", year: "2019", itemID: 1004, imageName: "iphone_11_pro", bannerName: "iphone_11_pro_wallpaper"),
Orchard(title: "iPhone XS", category: "iPhone", year: "2018", itemID: 1005, imageName: "iphone_xs", bannerName: "iphone_xs_wallpaper"),
Orchard(title: "iPhone SE 2nd Gen", category: "iPhone", year: "2020", itemID: 1006, imageName: "iphone_8", bannerName: "iphone_se_2_wallpaper")
]
I get the error "Global 'var' declaration requires an initializer expression or an explicitly stated getter"
Any help would be greatly appreciated, thanks!