Generic Instance Method


Returns a new key path created by appending the given key path to this one.


func appending<Root, Value, AppendedValue>(path: KeyPath<Value, AppendedValue>) -> KeyPath<Root, AppendedValue>



The key path to append.

Return Value

A key path from the root of this key path to the value type of path.


Use this method to extend this key path to the value type of another key path. Calling appending(path:) results in the same key path as if the given key path had been specified using dot notation. In the following example, keyPath1 and keyPath2 are equivalent:

let arrayDescription = \Array<Int>.description
let keyPath1 = arrayDescription.appending(path: \String.count)

let keyPath2 = \Array<Int>.description.count