Instance Method

validateValue:forKeyPath:error:

Returns a Boolean that indicates whether the value specified by a given pointer is valid for a given key path relative to the receiver.

Declaration

- (BOOL)validateValue:(inout id  _Nullable *)ioValue forKeyPath:(NSString *)inKeyPath error:(out NSError * _Nullable *)outError;

Parameters

ioValue

A pointer to a new value for the property identified by inKeyPath. This method may modify or replace the value in order to make it valid.

inKeyPath

The name of one of the receiver's properties. The key path must specify an attribute or a to-one relationship. The key path has the form relationship

.property (with one or more relationships); for example department.name or department.manager.lastName.
outError

If validation is necessary and ioValue is not transformed into a valid value, upon return contains an NSError object that describes the reason that ioValue is not a valid value.

Return Value

A Boolean that is YES if the value pointed at by ioValue is valid for the property identified by inKeyPath, or if the method is able to modify the value at ioValue to make it valid; otherwise NO.

Discussion

The default implementation of this method gets the destination object for each relationship using valueForKey: and returns the result of calling the validateValue:forKey:error: method for the property.

See Also

Validation

- validateValue:forKey:error:

Returns a Boolean that indicates whether the value specified by a given pointer is valid for the property identified by a given key.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software