<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/KeyPath",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s7KeyPathC"
  },
  "title" : "KeyPath"
}
-->

# KeyPath

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

```
class KeyPath<Root, Value>
```

## Overview

The most common way to make an instance of this type
is by using a key-path expression like `\SomeClass.someProperty`.
For more information,
see [Key-Path Expressions](https://docs.swift.org/swift-book/ReferenceManual/Expressions.html#ID563) in *[The Swift Programming Language](https://docs.swift.org/swift-book/)*.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)