FetchRequests is an eventing library inspired by NSFetchedResultsController and written in Swift.
- [x] Sort and section a list of items
- [x] Listen for live updates
- [x] Animate underlying data changes
- [x] Fetch associated values in batch
- [x] Support paginated requests
- [x] Comprehensive Unit Test Coverage
FetchRequests can be used for any combination of networking, database, and file queries. It is best when backed by something like a WebSocket where you're expecting your data to live update.
To get started, you create a
CWFetchRequest which explains your data access patterns.
CWFetchedResultsController is the interface to access the your data.
It will automatically cache your associated values for the lifetime of that controller.
If a memory pressure event occurs, it will release its hold on those objects, allowing them to be deinited.
The example app has an UserDefaults-backed storage mechanism. The unit tests have in-memory objects, with NotificationCenter eventing.
Today, it is heavily dependent on the Obj-C runtime, as well as Key-Value Observation. With Swift 5.1 it should be possible to further remove those restrictions.
It currently relies upon a
[String: Any] raw data representation.
Everything is in place to remove this restriction, but the swift compiler crashes if so.
- iOS 10+ / macOS 10.12+ / tvOS 10+ / watchOS 3+
- Xcode 10.2+
- Swift 5+
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Install with CocoaPods by specifying the following in your
pod 'FetchRequests', '~> 1.0'
Install with Carthage by specify the following in your
github "crewos/FetchRequests" ~> 1.0
Swift Package Manager
Install with Swift Package Manager by adding it to the
dependencies value of your
dependencies: [ .package(url: "https://github.com/crewos/FetchRequests.git", from: "1.0.0") ]
FetchRequests is released under the MIT license. See LICENSE for details.