Add SwiftData integration (ModelContainer dependency + ModelState)#2
Closed
corvid-agent wants to merge 1 commit into
Closed
Add SwiftData integration (ModelContainer dependency + ModelState)#2corvid-agent wants to merge 1 commit into
corvid-agent wants to merge 1 commit into
Conversation
Introduce an additive, fully gated SwiftData integration that follows AppState's existing conventions and does not change the package's platform requirements. - ModelContainer as an AppState dependency, with `Application.modelContext(_:)` to access the shared main-actor `ModelContext` from non-view code, and a `modelContainer(_:)` registration convenience. - `Application.ModelState<Model>`: a read-only `models` collection (live fetch via a `FetchDescriptor`) plus `insert`/`delete`/`save`/`deleteAll`. - `@ModelState` property wrapper exposing `[Model]`; mutate via the projected value (`$items.insert/delete/save/deleteAll`). - Unit tests (in-memory container) and a runnable example package. - Documentation: usage-modelstate guide plus README and usage-overview updates. Everything is gated behind `#if canImport(SwiftData)` and `@available` (iOS 17 / macOS 14 / tvOS 17 / watchOS 10 / visionOS 1), so the base iOS 15 / macOS 11 deployment targets and non-Apple platforms are unaffected. https://claude.ai/code/session_01KQ6g1YCLbH3wZkP8SuJ9vz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closing as redundant:
mainalready contains the SwiftDataModelStatefeature (via the v3 PR #1 merge), so this slim, standalone branch is no longer needed for the fork. Theswiftdata-modelstatebranch is kept in case a SwiftData-only contribution to upstream is wanted later.