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,4 Tsd.
aktive Profile

#swiftdata

1 Beitrag1 Beteiligte*r0 Beiträge heute
Axel Le Pennec<p>I enjoy using <a href="https://iosdev.space/tags/SwiftData" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftData</span></a> until I have to use a RawRepresentable (String or Int) enum in a Predicate.</p><p>Any tips to share?</p><p>Should I only store the enum RawValue instead of using the Enum type?</p>
Jonathan :mac:<p>Does anyone know how to move from an unversioned CoreData / Swift Data model to a versioned SwiftData model? I’m getting the following error:</p><p>"Cannot use staged migration with an unknown coordinator model version."</p><p><a href="https://techhub.social/tags/indiedev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>indiedev</span></a> <a href="https://techhub.social/tags/iosdev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iosdev</span></a> <a href="https://techhub.social/tags/swiftdata" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swiftdata</span></a> <a href="https://techhub.social/tags/swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swift</span></a></p>
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>

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

github.com/feedback-assistant/

Note: Core Data can do this without issue.

GitHubFB17593538: 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 · Issue #658 · feedback-assistant/reportsVon malhal

With Xcode 16.3 I'm seeing different #SwiftData 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.