FetchedResultsController
public class FetchedResultsController<T: NSManagedObject>
A type safe wrapper around an NSFetchedResultsController
-
The
NSFetchRequest
being used by theFetchedResultsController
Declaration
Swift
public var fetchRequest: NSFetchRequest<T>
-
Subscript access to the sections
Declaration
Swift
public subscript(indexPath: IndexPath) -> T { return internalController.object(at: indexPath) }
-
The objects that match the fetch request
Declaration
Swift
public var fetchedObjects: [T]?
-
The first object matching the fetch request
Declaration
Swift
public var first: T?
-
The number of objects matching the fetch request
Declaration
Swift
public var count: Int
-
The number of sections matching the fetch request
Declaration
Swift
public var sectionCount: Int
-
The sections returned by the
FetchedResultsController
seeFetchedResultsSectionInfo
Declaration
Swift
public var sections: LazyMapCollection<[NSFetchedResultsSectionInfo], FetchedResultsSectionInfo<T>>?
-
The name of the file used to cache section information.
Declaration
Swift
public var cacheName: String?
-
The
NSIndexPath
for a specific object in the fetchedObjectsDeclaration
Swift
public func indexPathForObject(_ object: T) -> IndexPath?
-
Initializer for the
FetchedResultsController
Declaration
Swift
public init(fetchRequest: NSFetchRequest<T>, managedObjectContext context: NSManagedObjectContext, sectionNameKeyPath: String? = nil, cacheName: String? = nil)
-
Function for setting the
FetchedResultsControllerDelegate
that will receive callback events.Declaration
Swift
public func setDelegate<U: FetchedResultsControllerDelegate>(_ delegate: U) where U.T == T
-
Executes the fetch request tied to the
FetchedResultsController
Throws
Any errors produced by theNSFetchResultsController
sperformFetch()
function.Declaration
Swift
public func performFetch() throws