mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,5 Tsd.
aktive Profile

#swiftdata

3 Beiträge3 Beteiligte0 Beiträge heute
Helge Heß<p>Is the <a href="https://mastodon.social/tags/SwiftLang" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftLang</span></a> Predicate macro used for anything else but <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a>? E.g. RealityKit has its own `QueryPredicate`.<br>It almost seems that Predicate is indeed somewhat useless w/o also standardizing the static metadata property, currently part of SwiftData's `PersistentModel`: <a href="https://developer.apple.com/documentation/swiftdata/persistentmodel/schemametadata" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">developer.apple.com/documentat</span><span class="invisible">ion/swiftdata/persistentmodel/schemametadata</span></a><br>As per <a href="https://forums.swift.org/t/keypath-string/77732" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">forums.swift.org/t/keypath-str</span><span class="invisible">ing/77732</span></a></p>
Jon Duenas<p>I was hoping I would be able to one day migrate away from <a href="https://mastodon.world/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> in my app. I built all this infrastructure to try and add abstraction around it for when that day would come. But, since I have CloudKit sync in production already, this is starting to feel more painful than it’ll be worth. I think I just need to embrace it. But STILL no sectioned Query is making this difficult.</p>
Helge Heß<p><a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> is a beauty. (also, all that WET)</p>
Konstantin 🔭<p>Does anyone know if there is a way to make SwiftData print more verbose model serialisation / migration errors?</p><p>For example, I'm converting a model field from String to a raw representable Enum, but something in the data is failing during automigration?</p><p><a href="https://mastodon.social/tags/Swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Swift</span></a> <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> <a href="https://mastodon.social/tags/SwiftDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftDev</span></a></p>
Axel Le Pennec<p>Oh wow 😲</p><p>SwiftData models are now Sendable! 🤩</p><p>And it has been backported to iOS 17.0+! 🥳</p><p>This will make working in with concurrent code easier.</p><p>Documentation updated during WWDC25: <a href="https://developer.apple.com/documentation/swiftdata/model" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">developer.apple.com/documentat</span><span class="invisible">ion/swiftdata/model</span></a>()</p><p><a href="https://iosdev.space/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> <a href="https://iosdev.space/tags/WWDC25" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>WWDC25</span></a></p>
Aleksander Stojanowski<p>Especially the <a href="https://iosdev.space/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> related code. I moved everything into the background thread, so that app works smoothly, but at the cost of code readability. Until I worked daily on that, it seemed fine. Nowadays, I see a lot of things I could improve.</p>
Patrick McConnell<p>One of the more tedious things to do with <a href="https://mastodon.social/tags/Xcode" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Xcode</span></a> and <a href="https://mastodon.social/tags/SwiftUI" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftUI</span></a> is to set up previews for complex scenarios such as things with deep <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> schemas.</p><p>Its also one of the more rewarding things. It's worth it 99 out of 100 times.</p><p>Not only can you iterate on views and components but it helps you think about your apps architecture. I almost always consider different structure to my code when I get stuck on creating a preview.</p><p><a href="https://mastodon.social/tags/iOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iOSDev</span></a> <a href="https://mastodon.social/tags/macOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>macOSDev</span></a></p>
Nico Reese<p>It's 2025 and it's still incredibly hard to achieve good iCloud sync without duplication of data. It's the developer's job to do this and it's so error prone if you don't do everything correctly. <a href="https://mastodon.social/tags/WWDC" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>WWDC</span></a> <a href="https://mastodon.social/tags/SwiftUI" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftUI</span></a> <a href="https://mastodon.social/tags/CoreData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CoreData</span></a> <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a></p>
Helge Heß<p>If you want to toy around with <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a>, but need some sample data, I have that <a href="https://mastodon.social/tags/Northwind" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Northwind</span></a> import. Which took a loooong time, but once it is in, it's ok 🙂 <br><a href="https://github.com/Northwind-swift/NorthwindSwiftData" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/Northwind-swift/Nor</span><span class="invisible">thwindSwiftData</span></a></p>
Deirdre Saoirse Moen<p>Adventures in mystery: if you use @Attribute(.externalStorage) in your <a href="https://hachyderm.io/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> app, how can you determine whether or not your data is stored in your db or externally?</p><p>Where's it stored in a Document-based app on macOS?</p><p>Fun times from exploring an (unrelated) db migration issue.</p><p><a href="https://deirdre.dev/posts/swift-data-images/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">deirdre.dev/posts/swift-data-i</span><span class="invisible">mages/</span></a></p><p><a href="https://hachyderm.io/tags/swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swift</span></a></p>
Florian<p>Am I missing something, or are relationships in <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> incredibly expensive? Inserting just 2,409 entries with a relationship takes 21s, compared to 0.5s without. Autosave is off, and I'm manually saving every 1,000 entries. What am I doing wrong?</p><p><a href="https://mastodon.social/tags/iOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iOSDev</span></a> <a href="https://mastodon.social/tags/Swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Swift</span></a></p>
Malcolm Hall<p>Found another bug in <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> and submitted Feedback this time with a Swift Testing suite to see if that helps get it fixed faster:</p><p>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</p><p><a href="https://github.com/feedback-assistant/reports/issues/658" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/feedback-assistant/</span><span class="invisible">reports/issues/658</span></a></p><p>Note: Core Data can do this without issue.</p>
Malcolm Hall<p><a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> @.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.</p><p><a href="https://stackoverflow.com/a/79616883/259521" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">stackoverflow.com/a/79616883/2</span><span class="invisible">59521</span></a></p>
Keith Harrison :clubtwit:<p>How do you write SwiftData predicates to query for parent relationships? <a href="https://twit.social/tags/iOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iOSDev</span></a> <a href="https://twit.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> <a href="https://twit.social/tags/SwiftUI" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftUI</span></a> <a href="https://useyourloaf.com/blog/swiftdata-predicates-for-parent-relationships/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">useyourloaf.com/blog/swiftdata</span><span class="invisible">-predicates-for-parent-relationships/</span></a></p>
Yannick Lung<p>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 ✨<br><a href="https://mastodon.social/tags/BuildInPublic" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BuildInPublic</span></a> <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a></p>
Helge Heß<p><span class="h-card" translate="no"><a href="https://c.im/@leogdion" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>leogdion</span></a></span> For <a href="https://mastodon.social/tags/SQLite" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SQLite</span></a> I also have Lighter, which I think is actually really good: <a href="https://github.com/Lighter-swift" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">github.com/Lighter-swift</span><span class="invisible"></span></a><br>And for Core Data I have replicated the <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> macros: <a href="https://github.com/Data-swift/ManagedModels/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/Data-swift/ManagedM</span><span class="invisible">odels/</span></a><br>This by <span class="h-card" translate="no"><a href="https://mastodon.social/@mattiem" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>mattiem</span></a></span> might also be relevant to your article: <a href="https://mastodon.social/@mattiem/114359442297769327" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">mastodon.social/@mattiem/11435</span><span class="invisible">9442297769327</span></a></p>
Patrick McConnell<p>I mentioned last week I would put together a blog post gathering my thoughts and process in working thru <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> Migrations.</p><p>Have at it…</p><p>SwiftData Migrations and the Real World: <a href="https://pmcconnell.micro.blog/2025/04/15/swiftdata-migrations-and-the-real.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">pmcconnell.micro.blog/2025/04/</span><span class="invisible">15/swiftdata-migrations-and-the-real.html</span></a></p><p><a href="https://mastodon.social/tags/Swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Swift</span></a> <a href="https://mastodon.social/tags/iOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iOSDev</span></a> <a href="https://mastodon.social/tags/macOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>macOSDev</span></a></p>
Malcolm Hall<p>With Xcode 16.3 I'm seeing different <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> auto-save behaviour in the simulator. Edits are now auto-saved a 10 sec delay. Weirdly the insert I tried in an onAppear (at same time app launch) is saved instantly. Previously the only auto-saves I saw on iOS were during app suspend.</p>
Rasmus Grouleff (he/him)<p>Heeeelp!</p><p>What does the following error mean, and how do I fix it? It happens, when I call `modelContext.save()` in a SwiftUI view.</p><p>"SwiftData/ModelCoders.swift:105: Fatal error: Composite Coder only supports Keyed Container”</p><p>Edit: Solved! It appears SwiftData does not support Duration properties in models. Changing it to a TimeInterval instead fixes it.</p><p><a href="https://mstdn.social/tags/Swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Swift</span></a> <a href="https://mstdn.social/tags/SwiftUI" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftUI</span></a> <a href="https://mstdn.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a></p>
Patrick McConnell<p>Biggest tip I can offer when working through a migration strategy, is to work on a new git branch so you can delete a bad data store, restore the old working branch and start over.</p><p>You can create a rollback strategy as well but I found it just as easy to delete the bad data store, revert to working data and try again.</p><p>If you don't start a migration clean and it has previously failed you may find a lot of duplicate data once it does work all the way thru.</p><p> <a href="https://mastodon.social/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> <a href="https://mastodon.social/tags/Swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Swift</span></a> <a href="https://mastodon.social/tags/iOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iOSDev</span></a> <a href="https://mastodon.social/tags/macOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>macOSDev</span></a></p>