registeredObject(for:)
Returns an object that exists in the context.
Declaration
func registeredObject(for objectID: NSManagedObjectID) -> NSManagedObject?Parameters
- objectID:
The identifier of the object to retrieve. For more information, see Nsmanagedobjectid.
Return Value
The identified object, if it’s known to the context; otherwise, nil.
Discussion
This method provides a convenient way to retrieve an object from the context’s registeredObjects property. A nil return value means the context doesn’t recognize the specified object; the object might still exist in the persistent store. If you need to query both the context and the store, use existingObject(with:) instead.