I followed Paul Hudson about SwiftData iTour tutorial.
Unfortunately my preview doesn't show anything.
Post
Replies
Boosts
Views
Activity
Xcode 15.1 - This is really preposterous! I cannot remove any document type I've added nor exported/imported type identifiers.
Thanks for the answer. Unfortunately this doesn't work. It falls over with "to-many key not allowed here" error.
Thank you so much. It worked. This really puzzles me as the documentation https://developer.apple.com/documentation/foundation/predicate says that swift optionals can be freely used with predicates.
The text doesn't have to be long. I've just noticed when you've got more than 40 lines the content gets into spasm.
iOS 18 beta 7, Xcode beta 6 (a slip-up)
An update: This issue occurs only in Debug mode and seems to be related to environment macros in the view. I had the following line defined:
@Environment(\.scenePhase) private var scenePhase
However, the variable wasn't even used. After removing that line, the problem disappeared.
I tried to create some code to reproduce the issue, but I couldn't get the issue to happen.
I've created an example app that replicates the issue or my wrong doing.
Follow this scenario for iOS17 and then iOS18 in the simulator.
Add 3 notes
Change review date for the second, and the third note.
Switch immediately to Reviews view and remember results.
Go back to Notes view
Switch to Reviews view again after ~20-25 seconds
In iOS17 the view is unchanged.
In iOS18 the change is reverted.
When you inspect the database with Core Data Lab you can see that the relationship property has been rolled back.
Example code can be downloaded from here
I do really hope someone else can spot what I am doing wrong.
I have finally found the culprit. I'm using 2 model contexts at the same time to update the data.
More information and demo app here.
Yes, at lease in iOS18.1 simulator the issue is completely gone. But this is a real shame that this happened and it hadn't been noticed before in any test suites.
It seems to be fixed in iOS 18.1 but this bug cost me a lot. After I exported data, deleted all data in the app and restored all data from the backup file, almost all tags had been lost before I noticed that something was not on. Red card for SwiftData team!