SyncableEntity
protocol · iOS 27.0+ · SDK 27.1
protocol SyncableEntity : AppEntityAn interface that indicates your entity has an identifier that’s consistent across devices. Adopt the `SyncableEntity` protocol in your entity types when they have an identifier that’s the same across devices. The presence of this protocol tells the system that it can refer to your entity consistently across devices. For eample, Siri uses this capability to transfer a conversation from one device to another. If you configure entities with an identifier that’s already consistent across devices, you can adopt this protocol without any additional changes. For example, if you initialize entities with a UUID you retrieve from your server, you can use that value for the identifier and not make any additional changes to your type. The following example shows an app entity type that adopts `SyncableEntity` and uses a server-based UUID. ```swift struct Article: AppEntity, SyncableEntity { var id: UUID // No changes needed! var title: String } ``` If your entity maintains different local and stable identifiers, adopt this protocol and set the type of your identifier to ``SyncableEntityIdentifier``. When creating an entity, initialize its `id` property with both the local and stable identifier values for your type, as shown in the following example. When you need to refer to an entity in your code, use the local identifier. ```swift struct Photo: AppEntity, SyncableEntity { var id: SyncableEntityIdentifier<String, String> var creationDate: Date init(localID: String, stableID: String, creationDate: Date) { self.id = SyncableEntityIdentifier(local: localID, stable: stableID) self.creationDate = creationDate } } ```
Members (0)
This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.
Skipped declarations
No declarations were skipped in this snapshot.