<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "swift: 5.9.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftData",
  "identifier" : "/documentation/SwiftData/Index(_:)-7d4z0",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData5IndexyyAA6SchemaCABC5TypesOy_x_xGd_tcAA15PersistentModelRzlufm"
  },
  "title" : "Index(_:)"
}
-->

# Index(_:)

Specifies the key-paths that SwiftData uses to create one or more indicies for
the associated model, where each index is either binary or R-tree.

```
@freestanding(declaration) macro Index<T>(_ indices: Schema.Index<T>.Types<T>...) where T : PersistentModel
```

---

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)