init
TypeScriptstatic init(activityIdentifier: string): (EntityIdentifier) | nullSwift declarationinit?(activityIdentifier: String)struct · iOS 16.0+ · SDK 27.1
struct EntityIdentifierA type that uniquely identifies a specific instance of an app entity. The value used should be unique across all entities of the given type. Entities which are relevant across executions of the application should have stable identifiers that persist across executions. Entities, by default, conform to the ``Identifiable`` protocol. Use a type for the `id` that conforms to ``EntityIdentifierConvertible``. Default implementations for `String`, `UUID` and `Int` are provided. For example: ``` struct Song: AppEntity { let id = UUID() } ``` ## Cross-Device Stable Identifiers For entities that adopt ``_SyncableEntity``, the framework automatically extracts stable identifiers for cross-device session syncing: - **Passthrough case**: If your entity's ID is already stable across devices (like server UUIDs), just adopt ``_SyncableEntity`` with no other changes. The framework uses your ID as both the local and stable identifier. - **Mapped case**: If your entity has different local and stable identifiers, use ``_SyncableEntityIdentifier`` as your ID type. The framework extracts the stable ID from the wrapper. - **Custom identifier case**: If your entity uses a custom ID type that conforms to ``_SyncableEntityIdentifierProviding``, the framework extracts the stable ID via the protocol's `stableIdentifierString` property. Apps never interact with `EntityIdentifier.stableIdentifier` directly - they work with their entity's ID type (plain types like `UUID`, ``_SyncableEntityIdentifier`` for mapped IDs, or custom types conforming to ``_SyncableEntityIdentifierProviding``). The stable identifier is NOT used for equality or hashing - two `EntityIdentifier` instances are equal if they have the same type and local identifier, regardless of stable identifier value.
static init(activityIdentifier: string): (EntityIdentifier) | nullSwift declarationinit?(activityIdentifier: String)get identifier(): stringSwift declarationlet identifier: StringValue uniquely identifying the entity instance within its type.
get description(): stringSwift declarationvar description: String { get }A textual representation of this instance. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(describing:)` initializer. This initializer works with any type, and uses the custom `description` property for types that conform to `CustomStringConvertible`: struct Point: CustomStringConvertible { let x: Int, y: Int var description: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(describing: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `description` property.
static get valueMaximumLength(): numberSwift declarationstatic let valueMaximumLength: IntMaximum allowed length for the `identifier` value. This is a constraint imposed by the system and thus forces us to truncate the identifier if it exceeds the maximum length.
static get defaultResolverSpecification(): EmptyResolverSpecification<EntityIdentifier>Swift declarationstatic var defaultResolverSpecification: EmptyResolverSpecification<EntityIdentifier>static set defaultResolverSpecification(value: EmptyResolverSpecification<EntityIdentifier>)Swift declarationstatic var defaultResolverSpecification: EmptyResolverSpecification<EntityIdentifier>3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
EntityIdentifier.entityType
Passing a Swift type itself is not supported.
EntityIdentifier.init(for:)
This declaration needs Swift generic type arguments. (no canonical witness for Entity)
EntityIdentifier.init(for:identifier:)
Passing a Swift type itself is not supported.