FetchedSetController
public class FetchedSetController : ContextObserver
A results controller that does not concern itself with the order of objects, but only their membership to the supplied fetch request.
-
A convenience initializer that takes an entity name and creates a fetch request
Declaration
Swift
convenience public init(context: NSManagedObjectContext, entityName: String)
Parameters
context
A managed object context to fetch from
entityName
An entity name to fetch
-
Initialize a controller with a context and request
Declaration
Swift
public init(context: NSManagedObjectContext, request: NSFetchRequest<NSManagedObject>)
Parameters
context
A managed object context to fetch from
request
A request for an entity
-
Fetches the object and begins monitoring the context for changes
Throws
A fetch error if one occursDeclaration
Swift
@discardableResult public func performFetch() throws -> [NSManagedObject]
Return Value
The initial contents of the controller
-
Clears all data and stops monitoring for changes in the context.
Declaration
Swift
public func reset()
-
Update the context and perform a fetch
Declaration
Swift
public func setManagedObjectContext(_ moc: NSManagedObjectContext) throws
Parameters
moc
The new managed object context
Return Value
A fetch error if one occurs
-
A fetch request (including a predicate if needed) for the entity to fetch
Declaration
Swift
public let fetchRequest: NSFetchRequest<NSManagedObject>
-
The delegate of the controller
Declaration
Swift
public weak var delegate: FetchedSetControllerDelegate? { get set }
-
The number of objects in the set
Declaration
Swift
public var numberOfObjects: Int { get }