---
title: EntityIdentifierConvertible
framework: appintents
role: symbol
role_heading: Protocol
path: appintents/entityidentifierconvertible
---

# EntityIdentifierConvertible

An interface for converting between an entity’s identifier and its string representation.

## Declaration

```swift
protocol EntityIdentifierConvertible
```

## Overview

Overview Every entity provides a stable, unique identifier that the framework uses as a concrete reference to the entity while mediating between your app and other parts of the system. To enforce this requirement, the AppEntity protocol inherits the Identifiable protocol. Wherever possible, use String, Int, or UUID for an identifier’s type. If you must use a different data type, use this protocol to extend that type and implement the required support. For example, an app that integrates with the MusicKit framework might use MusicItemID as the type for an entity’s identifier. extension MusicItemID: EntityIdentifierConvertible {     public var entityIdentifierString: String {         rawValue     }

public init?(entityIdentifierString: String) {         self = MusicItemID(entityIdentifierString)     } } important: Keep your entityIdentifierString to 4096 characters or fewer. Otherwise, the framework truncates the value, and you might not be able to convert the truncated value back to its originating type.

## Topics

### Creating an identifier string

- [entityIdentifier(for:)](appintents/entityidentifierconvertible/entityidentifier(for:).md)

### Getting the identifier string

- [entityIdentifierString](appintents/entityidentifierconvertible/entityidentifierstring.md)

## Relationships

### Conforming Types

- [FileEntityIdentifier](appintents/fileentityidentifier.md)
- [SyncableEntityIdentifier](appintents/syncableentityidentifier.md)

## See Also

### Entity identity

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