Contents

init(entityName:managedObjectHandler:)

Creates a batch-insertion request for a named managed entity, and specifies a closure that inserts data into the entity.

Declaration

convenience init(entityName: String, managedObjectHandler handler: @escaping (NSManagedObject) -> Bool)

Parameters

  • entityName:

    The name of the managed entity that defines the object to create.

  • handler:

    A closure that inserts data into the managed entity.

Return Value

A batch-insertion request.

Discussion

Core Data repeatedly calls the provided closure until it returns true, then finishes the request and saves the data.

See Also

Creating a Request