---
title: isTemporary
framework: swiftdata
role: symbol
role_heading: Instance Property
path: swiftdata/persistentidentifier/istemporary
---

# isTemporary

A Boolean value that indicates whether the identifier is temporary.

## Declaration

```swift
var isTemporary: Bool { get }
```

## Discussion

Discussion A temporary identifier is assigned to a model when it is first initialized. Once you call 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. if model.persistentModelID.isTemporary {     try modelContext.save() } let data = try JSONEncoder().encode(model.persistentModelID)
