Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save artembolotov/bfa903a2bab9382e7c22ca7f3ae3eef0 to your computer and use it in GitHub Desktop.
Save artembolotov/bfa903a2bab9382e7c22ca7f3ae3eef0 to your computer and use it in GitHub Desktop.
lazy var fetchedResultsController: NSFetchedResultsController<Event> = {
let request: NSFetchRequest<Event> = Event.fetchRequest()
request.fetchBatchSize = 20
request.sortDescriptors = [NSSortDescriptor(key: "registered", ascending: false)]
let controller = NSFetchedResultsController(fetchRequest: request, managedObjectContext:
CoreDataStack.viewContext, sectionNameKeyPath: #keyPath(Event.sectionKey), cacheName: nil)
controller.delegate = self
try! controller.performFetch()
return controller
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment