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
Post
Replies
Boosts
Views
Activity
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]
}