One Logo Pool Ball
SwiftData · IOS API REFERENCE

Schema

class · iOS 17.0+ · SDK 27.1

final class Schema

An object that maps model classes to data in the model store, and helps with the migration of that data between releases.

Members (9)

get · iOS 17.0+

entitiesByName

TypeScript
get entitiesByName(): Record<string, Schema_Entity>
Swift declaration
final let entitiesByName: [String : Schema.Entity]
get · iOS 17.0+

encodingVersion

TypeScript
get encodingVersion(): Schema_Version
Swift declaration
final let encodingVersion: Schema.Version
get · iOS 17.0+

debugDescription

TypeScript
get debugDescription(): string
Swift declaration
final var debugDescription: String { get }

A textual representation of this instance, suitable for debugging. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(reflecting:)` initializer. This initializer works with any type, and uses the custom `debugDescription` property for types that conform to `CustomDebugStringConvertible`: struct Point: CustomDebugStringConvertible { let x: Int, y: Int var debugDescription: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(reflecting: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `debugDescription` property.

get · iOS 17.0+

schemaEncodingVersion

TypeScript
static get schemaEncodingVersion(): Schema_Version
Swift declaration
static let schemaEncodingVersion: Schema.Version
static · iOS 17.0+

load

TypeScript
static load(fromURL: string): Schema
Swift declaration
static func load(from fromURL: URL) throws -> Schema
method · iOS 17.0+

save

TypeScript
save(toURL: string): void
Swift declaration
final func save(to toURL: URL) throws
get · iOS 17.0+

version

TypeScript
get version(): Schema_Version
Swift declaration
final let version: Schema.Version
get · iOS 17.0+

entities

TypeScript
get entities(): Array<Schema_Entity>
Swift declaration
final let entities: [Schema.Entity]
init · iOS 17.0+

init

TypeScript
static init(): Schema
Swift declaration
init()

Skipped declarations

6 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

Schema.init(_:version:)

A variable number of Swift arguments is not supported.

Schema.init(_:version:)

Passing a Swift type itself is not supported.

Schema.init(_:version:)

Passing a Swift type itself is not supported.

Schema.init(versionedSchema:)

Passing a Swift type itself is not supported.

Schema.entity(for:)

Passing a Swift type itself is not supported.

Schema.entityName(for:)

Passing a Swift type itself is not supported.

All SwiftData types →