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

# init(for:)

Creates an identifier for the specified entity.

## Declaration

```swift
init<Entity>(for entity: Entity) where Entity : AppEntity
```

## Parameters

- `entity`: The entity for which to create an identifier

## Discussion

Discussion For entities adopting _SyncableEntity, this initializer extracts the stable ID: Passthrough case: If the entity’s ID is already stable (like UUID), it’s used as both local and stable ID Mapped case: If the entity’s ID uses _SyncableEntityIdentifier, the stable ID is extracted from the wrapper Custom identifier case: If the entity’s ID conforms to _SyncableEntityIdentifierProviding, the stable ID is extracted via stableIdentifierString The stable ID is used for cross-device entity resolution via Campo session syncing.

## See Also

### Creating an entity identifier

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