Post

Replies

Boosts

Views

Activity

Comment on Xcode Version 15.0 beta 5 (15A5209g), SwiftData Problem - "The given data was not valid JSON."
Here's the model @sendtobo So the key thing here is that the initializer is DrawingData not Data @Model final class Page { init(timestamp: Date, canvasData: DrawingData, pdfData: DrawingData, stickers: [Sticker]) { self.timestamp = timestamp self.canvasData = canvasData self.pdfData = pdfData self.stickers = stickers } var timestamp: Date = Date() var canvasData: DrawingData var pdfData: DrawingData var stickers: [Sticker] }
Aug ’23
Comment on Xcode Version 15.0 beta 5 (15A5209g), SwiftData Problem - "The given data was not valid JSON."
Of course, see the above thread for the code. The important thing is to initialize the @Model with the codable struct (DrawingData in my case) not Data
Replies
Boosts
Views
Activity
Aug ’23
Comment on Xcode Version 15.0 beta 5 (15A5209g), SwiftData Problem - "The given data was not valid JSON."
Here's the model @sendtobo So the key thing here is that the initializer is DrawingData not Data @Model final class Page { init(timestamp: Date, canvasData: DrawingData, pdfData: DrawingData, stickers: [Sticker]) { self.timestamp = timestamp self.canvasData = canvasData self.pdfData = pdfData self.stickers = stickers } var timestamp: Date = Date() var canvasData: DrawingData var pdfData: DrawingData var stickers: [Sticker] }
Replies
Boosts
Views
Activity
Aug ’23