How SwiftData works
SwiftData was introduced with iOS 17 as a modern persistence layer for Swift apps. Developers define models with the @Model macro, and SwiftData handles local storage, querying, relationships, and UI updates.
For a productivity app, SwiftData is useful because saved items can load instantly without waiting for a network request. The app can filter, sort, and update resource cards directly from local storage.
SwiftData can be used with CloudKit in Apple apps, but this page only describes what is verified in SnapAction’s current implementation: a local resource library backed by SwiftData.
Example: a SnapAction resource model
A resource can include:
@Model
class Resource {
var title: String
var url: String?
var type: ResourceType
var resourceDescription: String?
var tags: [String]
var metadata: [String: String]
var screenshotAssetIds: [String]
var isRead: Bool
var isFavorite: Bool
var createdAt: Date
}
Result: The app can show a card, connect it to original screenshots, and power actions based on type-specific metadata.
How SnapAction uses SwiftData
SnapAction uses SwiftData as the local library that stores what the AI analysis returns after a screenshot scan.
- Fast browsing: Resource cards are available locally after they are saved.
- Typed actions: The stored type and metadata decide whether a card can open a URL, call a contact, show directions, add an event, or copy a booking reference.
- Screenshot linkage: Resource records can link back to one or more PhotoKit asset IDs, including grouped screenshots.
- Daily recall: Rewind can use local resource records to build a daily digest of what you saved.
SwiftData is the local memory layer. The screenshot analysis itself is handled by the Convex-backed AI pipeline.