After install XCode 15 beta 6:
@Model
class WordResult {
var text = ""
var translation:[String] = []
init(){
}
}
got this error:
Variable 'self._$backingData' used before being initialized
so I changed to :
@Model
class WordResult {
var text:String
var translation:[String]
init(){
self.text = ""
self.translation = []
}
}
Then got this:
CloudKit integration requires that all attributes be optional, or have a default value set
It seems it can not work with cloudkit now.
According to the Xcode 15 Beta 7 Release Notes:
SwiftData
Resolved Issues
- Fixed: @Model classes with initial values for stored properties result in an error that self._$backingData is used before being initialized. (113572344)
New builds with the new Xcode beta should not run into those issues.