Key-Path Expressions

Use key-path expressions to access properties dynamically.

Topics

Key Paths

class KeyPath

A key path from a specific root type to a specific resulting value type.

class PartialKeyPath

A partially type-erased key path, from a concrete root type to any resulting value type.

class AnyKeyPath

A type-erased key path, from any root type to any resulting value type. NOTE: older runtimes had Swift.AnyKeyPath as the ObjC name. The two must coexist, so it was renamed. The old name must not be used in the new runtime. _TtCs11_AnyKeyPath is the mangled name for Swift._AnyKeyPath.

protocol _AppendKeyPath

An implementation detail of key path expressions; do not use this protocol directly.

Writable Key Paths

class WritableKeyPath

A key path that supports reading from and writing to the resulting value.

class ReferenceWritableKeyPath

A key path that supports reading from and writing to the resulting value with reference semantics.

See Also

Programming Tasks

Input and Output

Print values to the console, read from and write to text streams, and use command line arguments.

Debugging and Reflection

Fortify your code with runtime checks, and examine your values' runtime representation.

Manual Memory Management

Allocate and manage memory manually.

Type Casting and Existential Types

Perform casts between types or represent values of any type.

C Interoperability

Use imported C types or call C variadic functions.

Operator Declarations

Work with prefix, postfix, and infix operators.