<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/EntityIdentifier/init(for:identifier:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents16EntityIdentifierV3for10identifierACxm_2IDQztcAA0aC0Rzlufc"
  },
  "title" : "init(for:identifier:)"
}
-->

# init(for:identifier:)

Creates an `EntityIdentifier` representing an instance of the specified entity type backed
by the specified identifier value.

```
init<Entity>(for entityType: Entity.Type, identifier: Entity.ID) where Entity : AppEntity
```

## Parameters

`entityType`

The type of the entity

`identifier`

The identifier value for the entity

## Discussion

For entity types adopting `_SyncableEntity`, this initializer extracts the stable ID:

- **Passthrough case**: If the ID is already stable (like `UUID`), it’s used as both local and stable ID
- **Mapped case**: If the ID uses `_SyncableEntityIdentifier`, the stable ID is extracted from the wrapper
- **Custom identifier case**: If the ID conforms to `_SyncableEntityIdentifierProviding`, the stable ID is extracted via `stableIdentifierString`

---

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)