Contents

init(for:)

Creates an identifier for the specified entity.

Declaration

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

Parameters

  • entity:

    The entity for which to create an identifier

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

The stable ID is used for cross-device entity resolution via Campo session syncing.

See Also

Creating an entity identifier