init(entity:managedObjectHandler:)
Creates a batch-insertion request for a managed entity, and specifies a closure that inserts data into the entity.
Declaration
convenience init(entity: NSEntityDescription, managedObjectHandler handler: @escaping (NSManagedObject) -> Bool)Parameters
- entity:
A managed entity to insert data into.
- 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.