Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonnickel/snap-swift-data
Extends SwiftData to better interoperate with CoreData and Persistent History Tracking.
https://github.com/simonnickel/snap-swift-data
core-data coredata swift swift-data swiftdata
Last synced: 5 days ago
JSON representation
Extends SwiftData to better interoperate with CoreData and Persistent History Tracking.
- Host: GitHub
- URL: https://github.com/simonnickel/snap-swift-data
- Owner: simonnickel
- License: mit
- Created: 2024-04-15T10:17:19.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-09T18:19:02.000Z (2 months ago)
- Last Synced: 2024-12-16T16:06:20.556Z (7 days ago)
- Topics: core-data, coredata, swift, swift-data, swiftdata
- Language: Swift
- Homepage:
- Size: 29.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsimonnickel%2Fsnap-swift-data%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/simonnickel/snap-swift-data)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsimonnickel%2Fsnap-swift-data%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/simonnickel/snap-swift-data)> This package is part of the [SNAP](https://github.com/simonnickel/snap) suite.
// TODO: Checkout WWDC24 changes to SwiftData regarding history tracking.
# SnapSwiftData
This package improves interoperability between SwiftData and CoreData. It provides SwiftData with access to CoreData objects and Persistent History Tracking.
SwiftData is build on CoreData, but does not completely cover its functionality. SnapSwiftData tries to fill some gaps, so you do not need to create a duplicated CoreData stack.
The package is heavily inspired by https://github.com/fatbobman/SwiftDataKit
[![Documentation][documentation badge]][documentation]
[documentation]: https://swiftpackageindex.com/simonnickel/snap-swift-data/main/documentation/snapswiftdata
[documentation badge]: https://img.shields.io/badge/Documentation-DocC-blue## Features
- Extensions
-- ModelContext.existingModel(for:)
-- NSManagedObjectID+PersistentIdentifier (by https://useyourloaf.com/blog/swiftdata-fetching-an-existing-object/)
- Persistent History Tracking (https://fatbobman.com/en/posts/persistent-history-tracking-in-swiftdata/)
- DataManager: A wrapper around ModelContainer with Persistent History Tracking.## Disclaimer
The implementation relies on current CoreData / SwiftData implementation details. This means it might break with future versions of SwiftData. Please use carefully.
Nothing in this package should not be necessary at all and be supported by SwiftData (FB13577205).
## Good to know
Add to launch arguments to silence CloudKit logs (see https://useyourloaf.com/blog/disabling-core-data-cloudkit-logging/):
`-com.apple.CoreData.Logging.stderr 0`