Post

Replies

Boosts

Views

Activity

Swiftdata: CloudKit integration requires that all attributes be optional, or have a default value set
Unfortunately I can not get swiftdata to work for me. I created a brand new project in Xcode, modified no code and the program fails with this error. Only thing I did was add an iCloud container. The default code that you are given for a swiftadata object is: @Model final class Item { var timestamp: Date init(timestamp: Date) { self.timestamp = timestamp } } Xcode wants that values in this model to ether be optional or have a default value. I thought this was a bug that had been fixed, but I am on the latest Xcode. I am not sure how to proceed. If the default code Xcode gives you won't compile, how am I able to code my own?
1
0
505
Oct ’23