newValue(forRelationship:forObjectWith:with:)
Returns the relationship for the given relationship of the object with a given object ID.
Declaration
func newValue(forRelationship relationship: NSRelationshipDescription, forObjectWith objectID: NSManagedObjectID, with context: NSManagedObjectContext?) throws -> AnyParameters
- relationship:
The relationship for which values are requested.
- objectID:
The ID of the object for which values are requested.
- context:
The managed object context into which values will be returned.
Return Value
The value of the relationship specified relationship of the object with object ID objectID, or nil if an error occurs.
Discussion
If the relationship is a to-one, the method should return an NSManagedObjectID instance that identifies the destination, or an instance of NSNull if the relationship value is nil.
If the relationship is a to-many, the method should return a collection object containing NSManagedObjectID instances to identify the related objects. Using an NSArray instance is preferred because it will be the most efficient. A store may also return an instance of NSSet or NSOrderedSet; an instance of NSDictionary is not acceptable.
If an object with object ID objectID cannot be found, the method should return nil and—if error is not NULL—create and return an appropriate error object in error.