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.
The 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. It should be possible to further remove those restrictions, and some effort has been made to remove them.
- iOS 12+ / macOS 10.14+ / tvOS 12+ / watchOS 5+
- Xcode 12+
- 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 Podfile
:
pod 'FetchRequests', '~> 3.0'
Install with Carthage by specify the following in your Cartfile
:
github "crewos/FetchRequests" ~> 3.0
Install with Swift Package Manager by adding it to the dependencies
value of your Package.swift
:
dependencies: [
.package(url: "https://github.com/crewos/FetchRequests.git", from: "3.0.0")
]
FetchRequests is released under the MIT license. See LICENSE for details.