Skip to content

NSFetchedResultsController inspired eventing

License

Notifications You must be signed in to change notification settings

lickel/FetchRequests

 
 

Repository files navigation

FetchRequests

FetchRequests is an eventing library inspired by NSFetchedResultsController and written in Swift.

Build Status codecov CocoaPods Compatible Carthage Compatible Platform Pod License

Features

  • 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

Usage

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.

Requirements

  • iOS 12+ / macOS 10.14+ / tvOS 12+ / watchOS 5+
  • Xcode 12+
  • Swift 5+

Communication

  • 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.

Installation

CocoaPods

Install with CocoaPods by specifying the following in your Podfile:

pod 'FetchRequests', '~> 3.0'

Carthage

Install with Carthage by specify the following in your Cartfile:

github "crewos/FetchRequests" ~> 3.0

Swift Package Manager

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")
]

License

FetchRequests is released under the MIT license. See LICENSE for details.

About

NSFetchedResultsController inspired eventing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.5%
  • Other 0.5%