Instance Method インスタンスメソッド

setValue(_:forKeyPath:)

Sets the value for the property identified by a given key path to a given value.

Declaration 宣言

func setValue(_ value: Any?, 
   forKeyPath keyPath: String)

Parameters パラメータ

value

The value for the property identified by keyPath.

keyPath

A key path of the form relationship.property (with one or more relationships): for example “department.name” or “department.manager.lastName.”

Discussion 解説

The default implementation of this method gets the destination object for each relationship using value(forKey:), and sends the final object a setValue(_:forKey:) message.

Special Considerations 特別な注意事項

When using this method, and the destination object does not implement an accessor for the value, the default behavior is for that object to retain value rather than copy or assign value.

See Also 参照

Setting Values 値を設定する

Related Documentation 関連文書