storeIdentifier
TypeScriptget storeIdentifier(): (string) | nullSwift declarationvar storeIdentifier: String? { get }The identifier of the store that contains the associated model.
struct · iOS 16.0+ · SDK 27.1
struct PersistentIdentifierA type that describes the aggregate identity of a SwiftData model. > Note: Decoded ``PersistentIdentifier`` and identifiers created by the ``DefaultStore`` are not considered equivalent.
get storeIdentifier(): (string) | nullSwift declarationvar storeIdentifier: String? { get }The identifier of the store that contains the associated model.
get entityName(): stringSwift declarationvar entityName: String { get }The entity name for the associated model.
get isTemporary(): booleanSwift declarationvar isTemporary: Bool { get }A Boolean value that indicates whether the identifier is temporary. A temporary identifier is assigned to a model when it is first initialized. Once you call ``ModelContext/save()``, the model receives a permanent identifier. Temporary identifiers should not be persisted or used to create durable maps to a model. Temporary identifiers are only valid until an object is persisted, and must be remapped to the permanent identifier once a model is saved. ```swift if model.persistentModelID.isTemporary { try modelContext.save() } let data = try JSONEncoder().encode(model.persistentModelID) ```
get id(): PersistentIdentifier_IDSwift declarationlet id: PersistentIdentifier.IDThe value that uniquely identifies the associated model within the containing store.
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
PersistentIdentifier.identifier(for:entityName:primaryKey:)
This declaration needs Swift generic type arguments. (no canonical witness for T)