---
title: "init(for:identifier:)"
framework: appintents
role: symbol
role_heading: Initializer
path: "appintents/entityidentifier/init(for:identifier:)"
---

# init(for:identifier:)

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

## Declaration

```swift
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

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

## See Also

### Creating an entity identifier

- [init(for:)](appintents/entityidentifier/init(for:).md)
- [init(activityIdentifier:)](appintents/entityidentifier/init(activityidentifier:).md)
