Use @Attribute(.externalStorage) to hint to SwiftData that large data like images should live outside the main store. It handles everything transparently, just don't try using those properties in predicates. hackingwithswift.com/quick-s…

Oct 20, 2026 · 12:10 PM UTC

9
4
30
6,914
RelevantRecentLikes
using this for meal photos and the cut-out stickers in my swiftdata food app. everything stays on device so photos pile up fast, and this kept the main store small with zero extra code
1
1
21
Blocked for mindless AI slop posting.
35
does that still work when the store syncs with cloudkit
12
Does this work with CloudKit as well?
1
40
the predicate gotcha got me once too. also worth knowing it really is just a hint: small blobs can still end up inline in the store, so it won't magically keep your SQLite file tiny 😅
33