Post

Replies

Boosts

Views

Activity

SwiftData looses attribute when restarting app
I'm trying to archive some data in my SwiftUI app, using SwiftData. I implemented a Archive Model: import Foundation import SwiftData @Model class ArchiveData { let archiveName: String let archiveDate: Date @Relationship(.cascade) var items: [Item] init(archiveName: String, archiveDate: Date, items: [Item]) { self.archiveName = archiveName self.archiveDate = archiveDate self.items = items } } Then, I'm adding the data to the context: let newArchive = ArchiveData(archiveName: name, archiveDate: Date.now, items: items) context.insert(newArchive) I can then display the archived data in a separate view. But when I restart the app, the items array of ArchiveData is empty. I couldn't find out, where I made a mistake. Can anyone help me?
1
0
579
Jun ’23
Can't distribute app to Testflight with Xcode 15 beta 2
Hi everyone I 'm trying to distribute my app with Testflight. When trying to submit a new build, I get the following errors: I 'm using Xcode 15 beta 2. Can anyone help me?
Replies
2
Boosts
1
Views
1.3k
Activity
Jul ’23
App crashes on iPhone
Hi everyone Yesterday, I updated my iPhone 14 to the newest iOS 17 beta release. Now, when I want to run my app on my iPhone, it crashes: This doesn't happen when I run the app on the Simulator. I'm using Xcode 15 beta 2. Can anyone help me?
Replies
0
Boosts
0
Views
767
Activity
Jun ’23
SwiftData looses attribute when restarting app
I'm trying to archive some data in my SwiftUI app, using SwiftData. I implemented a Archive Model: import Foundation import SwiftData @Model class ArchiveData { let archiveName: String let archiveDate: Date @Relationship(.cascade) var items: [Item] init(archiveName: String, archiveDate: Date, items: [Item]) { self.archiveName = archiveName self.archiveDate = archiveDate self.items = items } } Then, I'm adding the data to the context: let newArchive = ArchiveData(archiveName: name, archiveDate: Date.now, items: items) context.insert(newArchive) I can then display the archived data in a separate view. But when I restart the app, the items array of ArchiveData is empty. I couldn't find out, where I made a mistake. Can anyone help me?
Replies
1
Boosts
0
Views
579
Activity
Jun ’23