<!--
{
  "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(_:)-74ia2",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData5IndexyySays14PartialKeyPathCyxGGd_tcAA15PersistentModelRzlufm"
  },
  "title" : "Index(_:)"
}
-->

# Index(_:)

Specifies the key-paths that SwiftData uses to create one or more binary
indices for the associated model.

```
@freestanding(declaration) macro Index<T>(_ indices: [PartialKeyPath<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)