init(for:identifier:)
Creates an EntityIdentifier representing an instance of the specified entity type backed by the specified identifier value.
Declaration
init<Entity>(for entityType: Entity.Type, identifier: Entity.ID) where Entity : AppEntityParameters
- 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 IDMapped case: If the ID uses
_SyncableEntityIdentifier, the stable ID is extracted from the wrapperCustom identifier case: If the ID conforms to
_SyncableEntityIdentifierProviding, the stable ID is extracted viastableIdentifierString