This code worked perfectly fine with Xcode 15 beta 2.
@Model
final class Room {
var name: String = ""
@Relationship var plants: [Plant]?
init(name: String, plants: [Plant] = []) {
self.name = name
}
}
Right now, with Xcode 15 beta 6, the property declaration lines that have initial value throw this:
var name: String = "" // Variable 'self._$backingData' used before being initialized
Giving the initial value within the initialiser does not solve the issue, the modelContainer won't get initialised correctly and the app will crash.
CloudKit integration requires properties to have either initial values, or being the optional type. I'd like to avoid declaring optional values when not necessary.
Is this a bug? Or expected behaviour? Thanks for all the help.