---
title: PersistentModel
framework: swiftdata
role: symbol
role_heading: Protocol
path: swiftdata/persistentmodel
---

# PersistentModel

An interface that enables SwiftData to manage a Swift class as a stored model.

## Declaration

```swift
protocol PersistentModel : AnyObject, Observable, Hashable, Identifiable, SendableMetatype
```

## Mentioned in

Preserving your app’s model data across launches

## Topics

### Creating a persistent model

- [init(backingData:)](swiftdata/persistentmodel/init(backingdata:).md)

### Identifying the model instance

- [persistentModelID](swiftdata/persistentmodel/persistentmodelid.md)
- [PersistentIdentifier](swiftdata/persistentidentifier.md)
- [modelContext](swiftdata/persistentmodel/modelcontext.md)

### Accessing a value by key path

- [getValue(forKey:)](swiftdata/persistentmodel/getvalue(forkey:)-299oe.md)
- [getValue(forKey:)](swiftdata/persistentmodel/getvalue(forkey:)-3o59k.md)
- [getValue(forKey:)](swiftdata/persistentmodel/getvalue(forkey:)-4cs0c.md)
- [getValue(forKey:)](swiftdata/persistentmodel/getvalue(forkey:)-5m792.md)
- [getValue(forKey:)](swiftdata/persistentmodel/getvalue(forkey:)-998oq.md)
- [getTransformableValue(forKey:)](swiftdata/persistentmodel/gettransformablevalue(forkey:).md)

### Modifying a value by key path

- [setValue(forKey:to:)](swiftdata/persistentmodel/setvalue(forkey:to:)-18176.md)
- [setValue(forKey:to:)](swiftdata/persistentmodel/setvalue(forkey:to:)-3mmp2.md)
- [setValue(forKey:to:)](swiftdata/persistentmodel/setvalue(forkey:to:)-3uqwc.md)
- [setValue(forKey:to:)](swiftdata/persistentmodel/setvalue(forkey:to:)-8wepb.md)
- [setValue(forKey:to:)](swiftdata/persistentmodel/setvalue(forkey:to:)-xt24.md)
- [setTransformableValue(forKey:to:)](swiftdata/persistentmodel/settransformablevalue(forkey:to:).md)

### Accessing supplementary information

- [schemaMetadata](swiftdata/persistentmodel/schemametadata.md)
- [persistentBackingData](swiftdata/persistentmodel/persistentbackingdata.md)
- [hasChanges](swiftdata/persistentmodel/haschanges.md)
- [isDeleted](swiftdata/persistentmodel/isdeleted.md)

### Internal

- [Internal symbols](swiftdata/persistentmodelinternal.md)

### Associated Types

- [Root](swiftdata/persistentmodel/root.md)

### Type Methods

- [createBackingData()](swiftdata/persistentmodel/createbackingdata().md)

### Default Implementations

- [Equatable Implementations](swiftdata/persistentmodel/equatable-implementations.md)
- [Hashable Implementations](swiftdata/persistentmodel/hashable-implementations.md)

## Relationships

### Inherits From

- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [Identifiable](swift/identifiable.md)
- [Observable](observation/observable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Creating a model container

- [init(for:migrationPlan:configurations:)](swiftdata/modelcontainer/init(for:migrationplan:configurations:)-1czix.md)
- [init(for:migrationPlan:configurations:)](swiftdata/modelcontainer/init(for:migrationplan:configurations:)-8s4ts.md)
- [init(for:migrationPlan:configurations:)](swiftdata/modelcontainer/init(for:migrationplan:configurations:)-qof9.md)
- [ModelConfiguration](swiftdata/modelconfiguration.md)
- [Schema](swiftdata/schema.md)
- [SchemaMigrationPlan](swiftdata/schemamigrationplan.md)
