Hello! I have followed steps outlined in Build an app with SwiftData to create a document-based app to create and save a set of flashcards. I have defined by model as follows:
@Model
final class Card {
var createdAt: Date
var front: String
var back: String
init(front: String, back: String, createdAt: Date = .now) {
self.createdAt = createdAt
self.front = front
self.back = back
}
}
I am loading a document group as described in the video:
@main
struct DeckApp: App {
var body: some Scene {
#if os(iOS) || os(macOS)
DocumentGroup(editing: Card.self, contentType: .deck) {
ContentView()
}
#else
WindowGroup {
ContentView()
.modelContainer(for: Card.self)
}
#endif
}
}
Moreover, I have defined document and exported types in info.plist:
However, when I try to open a previously saved document, the items do not show up in the app, even though I can see some relevant strings in StoreContent-wal. Would anyone please be able to point me to something I must have missed? Thank you in advance.