I tried the code below, with SiftData models also below, but I got the error .. Value of type Sight has no member destination !
ForEach (destination.sights) { sight in
VStack {
Text(sight.name)
Text(sight.destination.name)
}
}
@Model
class Destination {
var name: String
var details: String
var date: Date
var priority: Int
@Relationship(deleteRule: .cascade) var sights = [Sight]()
init(name: String = "", details: String = "", date: Date = .now, priority: Int = 2) {
self.name = name
self.details = details
self.date = date
self.priority = priority
}
}
@Model
class Sight {
var name: String
init(name: String) {
self.name = name
}
}
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: