FetchRequests is an eventing library inspired by NSFetchedResultsController and written in Swift.
- ☑ Sort and section a list of items
- ☑ Listen for live updates
- ☑ Animate underlying data changes
- ☑ Fetch associated values in batch
- ☑ Support paginated requests
- ☑ 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
FetchRequest which explains your data access patterns.
FetchedResultsController 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 bundled
JSON raw data representation.
Everything is in place to remove this restriction, but there is a bug in the swift compiler.
- 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', '~> 2.0'
Install with Carthage by specify the following in your
github "crewos/FetchRequests" ~> 2.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: "2.0.0") ]
FetchRequests is released under the MIT license. See LICENSE for details.