Post

Replies

Boosts

Views

Activity

Reply to iPadOS 18 Beta and SwiftData issues
I get this error too, so the Relation isn't handled properly, so I set it through the association object, and the error goes away: @Model class School { @Relationship(deleteRule: .cascade) var students: [Student] = [] init() {} } @Model class Student { @Relationship(inverse: \School.students) var school: School init(school: School) { self.school = school } } let school = School() modelContext.insert(school) let student = Student(school: school) school.students.append(student) // <-- this works! try modelContext.save()
Aug ’24