Contents

init(id:)

Creates an identifier where the local and stable IDs are identical.

Declaration

init(id: LocalID)

Discussion

Use this for entities whose identifiers are already stable across devices, such as server-assigned UUIDs or globally unique identifiers.

Example

struct Article: AppEntity, SyncableEntity {
    var id: SyncableEntityIdentifier<UUID, UUID>

    init(id: UUID, title: String) {
        self.id = SyncableEntityIdentifier(id: id)
        self.title = title
    }
}