Instance Method


Subclasses should override this method to customize a fetch request, for example to specify fetch limits.


func fetch(with fetchRequest: NSFetchRequest<NSFetchRequestResult>?, merge: Bool) throws



The fetch request to use for the fetch. Pass nil to use the default fetch request.


If true, the receiver merges the existing content with the fetch result, otherwise the receiver replaces the entire content with the fetch result.


If an error occurs, upon return contains an NSError object that describes the problem.

Return Value

true if the fetch completed successfully, otherwise false.


This method performs a number of actions that you cannot reproduce. To customize this method, you should therefore create your own fetch request and then invoke super’s implementation with the new fetch request.

See Also

Core Data support

var entityName: String?

The entity name used by the receiver to create new objects.

func fetch(Any?)

Causes the receiver to fetch the data objects specified by the entity name and fetch predicate.

var usesLazyFetching: Bool

A Boolean that indicates whether the receiver uses lazy fetching.

func defaultFetchRequest() -> NSFetchRequest<NSFetchRequestResult>

Returns the default fetch request used by the receiver.

var fetchPredicate: NSPredicate?

The receiver’s fetch predicate.

var managedObjectContext: NSManagedObjectContext?

The receiver’s managed object context.