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 検証