Okay, so my crossposting app for Mastodon and Bluesky is taking shape now. ViewModel needs some cleanup with optionals (a side effect of making the #SwiftData #CloudKit compatible)
#bluesky #mastodon #ios #swift
Swift Developers and Indies! π£
Join us for the Swift Developer Goals meeting today at 12:30PM PT:
π» Sign up at https://swiftremotestudio.com
πͺ Join the Slack
π Go to the `goals-friday` channel for the Zoom link
See you there!
Figured out why my #SwiftData store was getting corrupted when no testers have seen this issue or even had a crash yet.
If I double clicked a file to be opened in my app Finder was digging out some old build from the trash with an old schema.
Inverse of works on my machine. Can only fail on my machine. Not helpful.
do this instead:
var myContainer = myModelContainer()
WindowGroup {
MyView()
}
.modelContainer(myContainer())
Using #SwiftData and you're instantiating your container inline with the Window creation something like this:
WindowGroup {
MyView()
}
.modelContainer(myModelContainer())
Will work fine on a Mac. The same thing on iOS will fail if you rotate the device or otherwise cause the Window to be recreated. The model context will be reset/recreated throwing an error.
Instantiate the container in your structure and pass that instead and all is good.
Ask me how I know?
This is one of the most satisfying projects I have ever worked on. MacInspector 0.1. Going to open a beta soon.
π¨ Livestream Alert!
Join me on May 15 at 11:00 AM CST for a hands-on SwiftData livestream. Learn how to set up SwiftData, perform CRUD operations, and understand its built-in architecture β all in SwiftUI.
Found another bug in #SwiftData and submitted Feedback this time with a Swift Testing suite to see if that helps get it fixed faster:
FB17593538: Inserted child model loses its relation to parent upon save if a fetch for the parent is done using includePendingChanges false in between insert and save
https://github.com/feedback-assistant/reports/issues/658
Note: Core Data can do this without issue.
Apparently since I launched my TestFlight beta for Cartographer something has broken with #SwiftData and now the app crashes at launch. Unclear if it's just my machine as I don't see any tester crashes reported.
Happy Monday everyone!
#SwiftData @.Model's implementation of id breaks the Identifiable protocol because it is not stable between insert and save. This means it does not work reliably with .sheet(item:) and is inefficient with List/ForEach.
I published a hot fix update this morning, but I even forgot to post about it. But itβs live and you can download it already. π
I, on the other hand, have been struggling with moving #SwiftData models to the shared framework. I can swear I worked yesterday! π
#BuildInPublic #IndieHacker #iOSDev #IndieDev
How do you write SwiftData predicates to query for parent relationships? #iOSDev #SwiftData #SwiftUI https://useyourloaf.com/blog/swiftdata-predicates-for-parent-relationships/
I searched a bit for what might be a problem and luckily I found the solution! All I needed to do was to move injecting #SwiftData model container into my RootView instead of WindowGroup as I did up to this point.
Join me for SwiftData Fundamentals β a hands-on workshop on May 16, 2025 (11 AMβ2 PM CST)!
Learn CRUD, relationships, unit testing, and CloudKit integration in SwiftData.
Perfect for beginners & pros alike!
π https://azamsharp.teachable.com/p/swiftdata-fundamentals-workshop
Join us for the Swift Developer Goals meeting today at 12:30PM PT! π
Sign up for the Slack access at swiftremotestudio.com and find the link to the Zoom meeting in the goals-friday channel.
In addition to goal setting, we also usually chat about:
#iOSDev #VisionPro #visionOS #SwiftUI #SwiftData
π Join me LIVE as we dive into SwiftData!
Learn how to perform CRUD operations, explore SwiftData architecture, and unlock the full power of model contexts and queries.
Donβt miss it!
Join us for the Swift Developer Goals meeting today at 12:30PM PT! π
Sign up for the Slack access at swiftremotestudio.com and find the link to the Zoom meeting in the goals-friday channel.
In addition to goal setting, we also usually chat about:
#iOSDev #VisionPro #visionOS #SwiftUI #SwiftData
Join us for the Swift Developer Goals meeting today at 12:30PM PT! π
Sign up for the Slack access at swiftremotestudio.com and find the link to the Zoom meeting in the goals-friday channel.
In addition to goal setting, we also usually chat about:
#iOSDev #VisionPro #visionOS #SwiftUI #SwiftData
I dug a little deeper into SwiftData and added one last quality of life improvement for version 2.0: widgets now show favorites and seen status and can now be filtered accordingly β¨
#BuildInPublic #SwiftData
@leogdion For #SQLite I also have Lighter, which I think is actually really good: https://github.com/Lighter-swift
And for Core Data I have replicated the #SwiftData macros: https://github.com/Data-swift/ManagedModels/
This by @mattiem might also be relevant to your article: https://mastodon.social/@mattiem/114359442297769327