---
title: SyncableEntityIdentifier
framework: appintents
role: symbol
role_heading: Structure
path: appintents/syncableentityidentifier
---

# SyncableEntityIdentifier

A type-safe wrapper you use to specify different local and stable identifiers for an entity.

## Declaration

```swift
struct SyncableEntityIdentifier<LocalID, StableID> where LocalID : EntityIdentifierConvertible, LocalID : Sendable, StableID : EntityIdentifierConvertible, StableID : Sendable
```

## Mentioned in

Defining app entities for your custom data types

## Overview

Overview Use this structure if you maintain separate local and stable identifiers in one of your entity types. Assign this structure to the id property of your entity and use the value in the local property to refer to the entity in your code. The system uses the stable value to refer to the same entity during operations that occur on another device. When referring to an entity in your code, you can refer to this type directly. The following example shows an entity that uses this type for its identifier. The query object for the entity similarly refers to this type directly in methods. struct Photo: AppEntity, SyncableEntity {     var id: SyncableEntityIdentifier<String, String>     var creationDate: Date }

struct PhotoQuery: EntityQuery {     func entities(for ids: [SyncableEntityIdentifier<String, String>]) async throws -> [Photo] {         // Works everywhere - queries, entities, helper functions     } } For additional information about how to use this type, see SyncableEntity.

## Topics

### Initializers

- [init(id:)](appintents/syncableentityidentifier/init(id:).md)
- [init(local:stable:)](appintents/syncableentityidentifier/init(local:stable:).md)

### Instance Properties

- [local](appintents/syncableentityidentifier/local.md)
- [stable](appintents/syncableentityidentifier/stable.md)

### Default Implementations

- [EntityIdentifierConvertible Implementations](appintents/syncableentityidentifier/entityidentifierconvertible-implementations.md)
- [Equatable Implementations](appintents/syncableentityidentifier/equatable-implementations.md)
- [Hashable Implementations](appintents/syncableentityidentifier/hashable-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [EntityIdentifierConvertible](appintents/entityidentifierconvertible.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Entity identity

- [EntityIdentifier](appintents/entityidentifier.md)
- [EntityIdentifierConvertible](appintents/entityidentifierconvertible.md)
- [FileEntityIdentifier](appintents/fileentityidentifier.md)
- [PersistentlyIdentifiable](appintents/persistentlyidentifiable.md)
- [AttributedEntityIdentifier](appintents/attributedentityidentifier.md)
- [AttributedTypeIdentifier](appintents/attributedtypeidentifier.md)
- [AppEntityAnnotatable](appintents/appentityannotatable.md)
- [AppEntityIdentifier](appintents/appentityidentifier.md)
