Returns the value for the derived property identified by a given key path.
SDKs
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
func value(forKeyPath keyPath: String) -> Any?
Parameters
keyPath
A key path of the form relationship
.property (with one or more relationships); for example “department.name” or “department.manager.lastName”.
Return Value
The value for the derived property identified by key
.
Discussion
The default implementation gets the destination object for each relationship using value(for
and returns the result of a value(for
message to the final object.