One Logo Pool Ball
App Frameworks · IOS API REFERENCE

SwiftData

Write your model code declaratively to add managed persistence and efficient model fetching.

110 types

336 callable entries

104 skipped

76% entry coverage

Generated from iOS SDK 27.1. Availability is shown on each declaration; permissions and entitlements still apply.

Types

Array.PersistentElement

typealias · iOS 17.0+

BackingData

protocol · iOS 17.0+

DataStore

protocol · iOS 18.0+

DataStoreBatchDeleteRequest

struct · iOS 18.0+

DataStoreBatching

protocol · iOS 18.0+

DataStoreConfiguration

protocol · iOS 18.0+

DataStoreError

enum · iOS 18.0+

DataStoreFetchRequest

struct · iOS 18.0+

DataStoreFetchResult

struct · iOS 18.0+

DataStoreSaveChangesRequest

struct · iOS 18.0+

DataStoreSaveChangesResult

class · iOS 18.0+

DataStoreSnapshot

protocol · iOS 18.0+

DataStoreSnapshotCodingKey

enum · iOS 18.0+

DataStoreSnapshotValue

typealias · iOS 18.0+

DefaultHistoryDelete

struct · iOS 18.0+

DefaultHistoryDelete.ChangeIdentifier

typealias · iOS 18.0+

DefaultHistoryDelete.TransactionIdentifier

typealias · iOS 18.0+

DefaultHistoryInsert

struct · iOS 18.0+

DefaultHistoryInsert.ChangeIdentifier

typealias · iOS 18.0+

DefaultHistoryInsert.TransactionIdentifier

typealias · iOS 18.0+

DefaultHistoryToken

struct · iOS 18.0+

DefaultHistoryToken.ID

typealias · iOS 18.0+

DefaultHistoryToken.TokenType

typealias · iOS 18.0+

DefaultHistoryTransaction

struct · iOS 18.0+

DefaultHistoryTransaction.ID

typealias · iOS 18.0+

DefaultHistoryTransaction.TokenType

typealias · iOS 18.0+

DefaultHistoryTransaction.TransactionIdentifier

typealias · iOS 18.0+

DefaultHistoryUpdate

struct · iOS 18.0+

DefaultHistoryUpdate.ChangeIdentifier

typealias · iOS 18.0+

DefaultHistoryUpdate.PropertyUpdate

typealias · iOS 18.0+

DefaultHistoryUpdate.TransactionIdentifier

typealias · iOS 18.0+

DefaultSerialModelExecutor

class · iOS 17.0+

DefaultSnapshot

struct · iOS 18.0+

DefaultStore

class · iOS 18.0+

DefaultStore.Configuration

typealias · iOS 18.0+

DefaultStore.HistoryType

typealias · iOS 18.0+

DefaultStore.Snapshot

typealias · iOS 18.0+

DefaultStore.TokenType

typealias · iOS 18.0+

EditingState

struct · iOS 18.0+

EditingState.ID

typealias · iOS 18.0+

FetchDescriptor

struct · iOS 17.0+

FetchResultsCollection

struct · iOS 17.0+

FetchResultsCollection.Index

typealias · iOS 17.0+

FetchResultsCollection.Indices

typealias · iOS 17.0+

FetchResultsCollection.Iterator

typealias · iOS 17.0+

FetchResultsCollection.SubSequence

typealias · iOS 17.0+

HistoryChange

enum · iOS 18.0+

HistoryDelete

protocol · iOS 18.0+

HistoryDescriptor

struct · iOS 18.0+

HistoryInsert

protocol · iOS 18.0+

HistoryObserver

class · iOS 27.0+

HistoryProviding

protocol · iOS 18.0+

HistoryToken

protocol · iOS 18.0+

HistoryTombstone

struct · iOS 18.0+

HistoryTombstone.Element

typealias · iOS 18.0+

HistoryTombstone.Iterator

struct · iOS 18.0+

HistoryTombstone.Iterator.Element

typealias · iOS 18.0+

HistoryTransaction

protocol · iOS 18.0+

HistoryUpdate

protocol · iOS 18.0+

HistoryUpdate.PropertyUpdate

typealias · iOS 18.0+

MigrationStage

enum · iOS 17.0+

ModelActor

protocol · iOS 17.0+

ModelConfiguration

struct · iOS 17.0+

ModelConfiguration.CloudKitDatabase

struct · iOS 17.0+

ModelConfiguration.GroupContainer

struct · iOS 17.0+

ModelConfiguration.ID

typealias · iOS 17.0+

ModelConfiguration.Store

typealias · iOS 18.0+

ModelContainer

class · iOS 17.0+

ModelContext

class · iOS 17.0+

ModelContext.NotificationKey

enum · iOS 17.0+

ModelContext.NotificationKey.RawValue

typealias · iOS 17.0+

ModelExecutor

protocol · iOS 17.0+

Optional.PersistentElement

typealias · iOS 17.0+

PersistentIdentifier

struct · iOS 16.0+

PersistentIdentifier.ID

struct · iOS 16.0+

PersistentModel

protocol · iOS 17.0+

RelationshipCollection

protocol · iOS 17.0+

ResultsObserver

class · iOS 27.0+

ResultsSection

struct · iOS 27.0+

ResultsSection.ID

typealias · iOS 27.0+

ResultsSection.Index

typealias · iOS 27.0+

ResultsSection.Indices

typealias · iOS 27.0+

ResultsSection.Iterator

typealias · iOS 27.0+

ResultsSection.SubSequence

typealias · iOS 27.0+

Schema

class · iOS 17.0+

Schema.Attribute

class · iOS 17.0+

Schema.Attribute.Option

struct · iOS 17.0+

Schema.CompositeAttribute

class · iOS 17.0+

Schema.Entity

class · iOS 17.0+

Schema.Index

class · iOS 18.0+

Schema.Index.CodingKeys

enum · iOS 18.0+

Schema.Index.Types

enum · iOS 18.0+

Schema.PropertyMetadata

struct · iOS 17.0+

Schema.Relationship

class · iOS 17.0+

Schema.Relationship.DeleteRule

enum · iOS 17.0+

Schema.Relationship.DeleteRule.RawValue

typealias · iOS 17.0+

Schema.Relationship.Option

struct · iOS 17.0+

Schema.Unique

class · iOS 18.0+

Schema.Unique.CodingKeys

enum · iOS 18.0+

Schema.Version

struct · iOS 17.0+

SchemaMigrationPlan

protocol · iOS 17.0+

SchemaProperty

protocol · iOS 17.0+

SectionedResults

struct · iOS 27.0+

SectionedResults.Index

typealias · iOS 27.0+

SectionedResults.Indices

typealias · iOS 27.0+

SectionedResults.Iterator

typealias · iOS 27.0+

SectionedResults.SubSequence

typealias · iOS 27.0+

SerialModelExecutor

protocol · iOS 17.0+

SwiftDataError

struct · iOS 17.0+

VersionedSchema

protocol · iOS 17.0+

Functions and constants

get · iOS 18.0+

descriptor

TypeScript
get descriptor(): FetchDescriptor<SDKHandle>
Swift declaration
let descriptor: FetchDescriptor<ModelType>
get · iOS 18.0+

fetchedSnapshots

TypeScript
get fetchedSnapshots(): Array<DefaultSnapshot>
Swift declaration
let fetchedSnapshots: [SnapshotType]
get · iOS 18.0+

relatedSnapshots

TypeScript
get relatedSnapshots(): NativeMap<PersistentIdentifier, DefaultSnapshot>
Swift declaration
let relatedSnapshots: [PersistentIdentifier : SnapshotType]
get · iOS 18.0+

descriptor

TypeScript
get descriptor(): FetchDescriptor<SDKHandle>
Swift declaration
let descriptor: FetchDescriptor<T>
get · iOS 18.0+

editingState

TypeScript
get editingState(): EditingState
Swift declaration
let editingState: EditingState
get · iOS 27.0+

historyToken

TypeScript
get historyToken(): (SDKHandle) | null
Swift declaration
final let historyToken: (any HistoryToken)?
get · iOS 18.0+

storeIdentifier

TypeScript
get storeIdentifier(): string
Swift declaration
final let storeIdentifier: String
get · iOS 18.0+

remappedIdentifiers

TypeScript
get remappedIdentifiers(): NativeMap<PersistentIdentifier, PersistentIdentifier>
Swift declaration
final let remappedIdentifiers: [PersistentIdentifier : PersistentIdentifier]
get · iOS 18.0+

snapshotsToReregister

TypeScript
get snapshotsToReregister(): NativeMap<PersistentIdentifier, DefaultSnapshot>
Swift declaration
final let snapshotsToReregister: [PersistentIdentifier : T]
init · iOS 27.0+

init

TypeScript
static initForRemappedIdentifiersSnapshotsToReregisterHistoryToken(storeIdentifier: string, remappedIdentifiers?: NativeMap<PersistentIdentifier, PersistentIdentifier>, snapshotsToReregister?: NativeMap<PersistentIdentifier, DefaultSnapshot>, historyToken?: (SDKHandle) | null): DataStoreSaveChangesResult<DefaultSnapshot>
Swift declaration
init(for storeIdentifier: String, remappedIdentifiers: [PersistentIdentifier : PersistentIdentifier] = [:], snapshotsToReregister: [PersistentIdentifier : T] = [:], historyToken: (any HistoryToken)?)
init · iOS 18.0+

init

TypeScript
static initForRemappedIdentifiersSnapshotsToReregister(storeIdentifier: string, remappedIdentifiers?: NativeMap<PersistentIdentifier, PersistentIdentifier>, snapshotsToReregister?: NativeMap<PersistentIdentifier, DefaultSnapshot>): DataStoreSaveChangesResult<DefaultSnapshot>
Swift declaration
init(for storeIdentifier: String, remappedIdentifiers: [PersistentIdentifier : PersistentIdentifier] = [:], snapshotsToReregister: [PersistentIdentifier : T] = [:])
get · iOS 18.0+

editingState

TypeScript
get editingState(): EditingState
Swift declaration
let editingState: EditingState
get · iOS 18.0+

includeSubclasses

TypeScript
get includeSubclasses(): boolean
Swift declaration
let includeSubclasses: Bool
get · iOS 18.0+

predicate

TypeScript
get predicate(): (_Foundation_Predicate<SDKHandle>) | null
Swift declaration
let predicate: Predicate<T>?
get · iOS 18.0+

editingState

TypeScript
get editingState(): EditingState
Swift declaration
let editingState: EditingState
get · iOS 18.0+

deleted

TypeScript
get deleted(): Array<DefaultSnapshot>
Swift declaration
let deleted: [SnapshotType]
get · iOS 18.0+

updated

TypeScript
get updated(): Array<DefaultSnapshot>
Swift declaration
let updated: [SnapshotType]
get · iOS 18.0+

inserted

TypeScript
get inserted(): Array<DefaultSnapshot>
Swift declaration
let inserted: [SnapshotType]
get · iOS 27.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.

get · iOS 27.0+

id

TypeScript
get id(): number
Swift declaration
var id: SectionTitle { get }

The unique identifier for the section, which is its ``title``.

get · iOS 27.0+

title

TypeScript
get title(): number
Swift declaration
let title: SectionTitle

The identifier of the section. This is the common value shared by all elements in this section, as determined by the `sectionBy` key path provided at creation.

get · iOS 27.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

The collection's "past the end" position---that is, the position one greater than the last valid subscript argument. When you need a range that includes the last element of a collection, use the half-open range operator (`..<`) with `endIndex`. The `..<` operator creates a range that doesn't include the upper bound, so it's always safe to use with `endIndex`. For example: let numbers = [10, 20, 30, 40, 50] if let index = numbers.firstIndex(of: 30) { print(numbers[index ..< numbers.endIndex]) } // Prints "[30, 40, 50]" If the collection is empty, `endIndex` is equal to `startIndex`.

get · iOS 17.0+

fetchLimit

TypeScript
get fetchLimit(): (number) | null
Swift declaration
var fetchLimit: Int?
set · iOS 17.0+

fetchLimit

TypeScript
set fetchLimit(value: (number) | null)
Swift declaration
var fetchLimit: Int?
get · iOS 17.0+

fetchOffset

TypeScript
get fetchOffset(): (number) | null
Swift declaration
var fetchOffset: Int?
set · iOS 17.0+

fetchOffset

TypeScript
set fetchOffset(value: (number) | null)
Swift declaration
var fetchOffset: Int?
get · iOS 17.0+

includePendingChanges

TypeScript
get includePendingChanges(): boolean
Swift declaration
var includePendingChanges: Bool
set · iOS 17.0+

includePendingChanges

TypeScript
set includePendingChanges(value: boolean)
Swift declaration
var includePendingChanges: Bool
get · iOS 17.0+

sortBy

TypeScript
get sortBy(): Array<_Foundation_SortDescriptor<SDKHandle>>
Swift declaration
var sortBy: [SortDescriptor<T>]
set · iOS 17.0+

sortBy

TypeScript
set sortBy(value: Array<_Foundation_SortDescriptor<SDKHandle>>)
Swift declaration
var sortBy: [SortDescriptor<T>]
get · iOS 17.0+

predicate

TypeScript
get predicate(): (_Foundation_Predicate<SDKHandle>) | null
Swift declaration
var predicate: Predicate<T>?
set · iOS 17.0+

predicate

TypeScript
set predicate(value: (_Foundation_Predicate<SDKHandle>) | null)
Swift declaration
var predicate: Predicate<T>?
get · iOS 27.0+

modelContext

TypeScript
get modelContext(): ModelContext
Swift declaration
final let modelContext: ModelContext

The model context from which models are fetched. This context is set at initialization and determines the data store and change-tracking scope for the observer.

get · iOS 27.0+

fetchDescriptor

TypeScript
get fetchDescriptor(): FetchDescriptor<SDKHandle>
Swift declaration
final var fetchDescriptor: FetchDescriptor<Element> { get }

The fetch descriptor used to query the model context. This descriptor defines the complete fetch criteria including predicate, sort descriptors, and other fetch options. It is configured at initialization and can be indirectly modified through the ``filterBy`` and ``sortBy`` computed properties.

get · iOS 27.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 27.0+

sortBy

TypeScript
get sortBy(): Array<_Foundation_SortDescriptor<SDKHandle>>
Swift declaration
final var sortBy: [SortDescriptor<Element>] { get set }

The sort descriptors used to order the results. Setting this property updates the underlying ``fetchDescriptor``'s sort descriptors and immediately refetches on the calling actor. When sectioning is active, the section's sort descriptor is automatically re-prepended if not already the first descriptor. A `SortDescriptor` by `persistentModelID` is appended automatically if not already present to ensure stable ordering for difference computation.

set · iOS 27.0+

sortBy

TypeScript
set sortBy(value: Array<_Foundation_SortDescriptor<SDKHandle>>)
Swift declaration
final var sortBy: [SortDescriptor<Element>] { get set }

The sort descriptors used to order the results. Setting this property updates the underlying ``fetchDescriptor``'s sort descriptors and immediately refetches on the calling actor. When sectioning is active, the section's sort descriptor is automatically re-prepended if not already the first descriptor. A `SortDescriptor` by `persistentModelID` is appended automatically if not already present to ensure stable ordering for difference computation.

get · iOS 27.0+

results

TypeScript
get results(): FetchResultsCollection<SDKHandle>
Swift declaration
final var results: FetchResultsCollection<Element> { get set }

The current collection of fetched models matching the fetch criteria. This property is updated automatically when relevant changes occur in the model context. As an `@Observable` property, SwiftUI views that read this value will automatically refresh when the results change.

set · iOS 27.0+

results

TypeScript
set results(value: FetchResultsCollection<SDKHandle>)
Swift declaration
final var results: FetchResultsCollection<Element> { get set }

The current collection of fetched models matching the fetch criteria. This property is updated automatically when relevant changes occur in the model context. As an `@Observable` property, SwiftUI views that read this value will automatically refresh when the results change.

get · iOS 27.0+

filterBy

TypeScript
get filterBy(): (_Foundation_Predicate<SDKHandle>) | null
Swift declaration
final var filterBy: Predicate<Element>? { get set }

The predicate used to filter which models are included in the results. Setting this property updates the underlying ``fetchDescriptor``'s predicate and immediately refetches on the calling actor — results are synchronously up to date before the setter returns. Set to `nil` to remove filtering and include all models of this type.

set · iOS 27.0+

filterBy

TypeScript
set filterBy(value: (_Foundation_Predicate<SDKHandle>) | null)
Swift declaration
final var filterBy: Predicate<Element>? { get set }

The predicate used to filter which models are included in the results. Setting this property updates the underlying ``fetchDescriptor``'s predicate and immediately refetches on the calling actor — results are synchronously up to date before the setter returns. Set to `nil` to remove filtering and include all models of this type.

get · iOS 27.0+

sections

TypeScript
get sections(): (SectionedResults<SDKHandle, number>) | null
Swift declaration
final var sections: SectionedResults<Element, SectionTitle>? { get set }

The sections computed from the current results, grouped by ``sectionBy``. Returns `nil` if this observer was created without a `sectionBy` key path (i.e. `SectionTitle == Never`). When sectioning is enabled, returns a ``SectionedResults`` of sections ordered by their first appearance in the sorted results. The `sectionBy` key path is automatically prepended as the first sort descriptor at initialization, and re-prepended if ``sortBy`` is mutated, ensuring results are always contiguous within each section.

set · iOS 27.0+

sections

TypeScript
set sections(value: (SectionedResults<SDKHandle, number>) | null)
Swift declaration
final var sections: SectionedResults<Element, SectionTitle>? { get set }

The sections computed from the current results, grouped by ``sectionBy``. Returns `nil` if this observer was created without a `sectionBy` key path (i.e. `SectionTitle == Never`). When sectioning is enabled, returns a ``SectionedResults`` of sections ordered by their first appearance in the sorted results. The `sectionBy` key path is automatically prepended as the first sort descriptor at initialization, and re-prepended if ``sortBy`` is mutated, ensuring results are always contiguous within each section.

method · iOS 18.0+

makeIterator

TypeScript
makeIterator(): HistoryTombstone_Iterator<SDKHandle>
Swift declaration
func makeIterator() -> HistoryTombstone<Model>.Iterator

Returns an iterator over the elements of this sequence.

method · iOS 18.0+

next

TypeScript
next(): (unknown) | null
Swift declaration
mutating func next() -> Any?

Advances to the next element and returns it, or `nil` if no next element exists. Repeatedly calling this method returns, in order, all the elements of the underlying sequence. As soon as the sequence has run out of elements, all subsequent calls return `nil`. You must not call this method if any other copy of this iterator has been advanced with a call to its `next()` method. The following example shows how an iterator can be used explicitly to emulate a `for`-`in` loop. First, retrieve a sequence's iterator, and then call the iterator's `next()` method until it returns `nil`. let numbers = [2, 3, 5, 7] var numbersIterator = numbers.makeIterator() while let num = numbersIterator.next() { print(num) } // Prints "2" // Prints "3" // Prints "5" // Prints "7" - Returns: The next element in the underlying sequence, if a next element exists; otherwise, `nil`.

get · iOS 27.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.

subscript · iOS 27.0+

subscript

TypeScript
subscriptSectionTitle(title: number): (ResultsSection<SDKHandle, number>) | null
Swift declaration
subscript(sectionTitle title: SectionTitle) -> ResultsSection<Element, SectionTitle>? { get }

Returns the section with the given title, or `nil` if no such section exists. - Complexity: O(1)

get · iOS 27.0+

sectionTitles

TypeScript
get sectionTitles(): Array<number>
Swift declaration
var sectionTitles: [SectionTitle] { get }

The section titles in order.

method · iOS 27.0+

index

TypeScript
index(title: number): (number) | null
Swift declaration
func index(ofSectionTitled title: SectionTitle) -> Int?

Returns the ordered index of the section with the given title, or `nil` if not found. - Complexity: O(1)

method · iOS 27.0+

contains

TypeScript
contains(title: number): boolean
Swift declaration
func contains(sectionTitle title: SectionTitle) -> Bool

Returns whether a section with the given title exists in the collection. - Complexity: O(1)

get · iOS 27.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

The collection's "past the end" position---that is, the position one greater than the last valid subscript argument. When you need a range that includes the last element of a collection, use the half-open range operator (`..<`) with `endIndex`. The `..<` operator creates a range that doesn't include the upper bound, so it's always safe to use with `endIndex`. For example: let numbers = [10, 20, 30, 40, 50] if let index = numbers.firstIndex(of: 30) { print(numbers[index ..< numbers.endIndex]) } // Prints "[30, 40, 50]" If the collection is empty, `endIndex` is equal to `startIndex`.

subscript · iOS 27.0+

subscript

TypeScript
subscript(position: number): ResultsSection<SDKHandle, number>
Swift declaration
subscript(position: Int) -> ResultsSection<Element, SectionTitle> { get }

Accesses the element at the specified position. The following example accesses an element of an array through its subscript to print its value: var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] print(streets[1]) // Prints "Bryant" You can subscript a collection with any valid index other than the collection's end index. The end index refers to the position one past the last element of a collection, so it doesn't correspond with an element. - Parameter position: The position of the element to access. `position` must be a valid index of the collection that is not equal to the `endIndex` property. - Complexity: O(1)

get · iOS 18.0+

fetchLimit

TypeScript
get fetchLimit(): number
Swift declaration
var fetchLimit: UInt64
set · iOS 18.0+

fetchLimit

TypeScript
set fetchLimit(value: number)
Swift declaration
var fetchLimit: UInt64
get · iOS 26.0+

sortBy

TypeScript
get sortBy(): Array<_Foundation_SortDescriptor<DefaultHistoryTransaction>>
Swift declaration
var sortBy: [SortDescriptor<TransactionType>]
set · iOS 26.0+

sortBy

TypeScript
set sortBy(value: Array<_Foundation_SortDescriptor<DefaultHistoryTransaction>>)
Swift declaration
var sortBy: [SortDescriptor<TransactionType>]
get · iOS 18.0+

predicate

TypeScript
get predicate(): (_Foundation_Predicate<DefaultHistoryTransaction>) | null
Swift declaration
var predicate: Predicate<TransactionType>?
set · iOS 18.0+

predicate

TypeScript
set predicate(value: (_Foundation_Predicate<DefaultHistoryTransaction>) | null)
Swift declaration
var predicate: Predicate<TransactionType>?
init · iOS 26.0+

init

TypeScript
static initPredicateSortBy(predicate?: (_Foundation_Predicate<DefaultHistoryTransaction>) | null, sortBy?: Array<_Foundation_SortDescriptor<DefaultHistoryTransaction>>): HistoryDescriptor<DefaultHistoryTransaction>
Swift declaration
init(predicate: Predicate<TransactionType>? = nil, sortBy: [SortDescriptor<TransactionType>] = [])
init · iOS 18.0+

init

TypeScript
static initPredicate(predicate?: (_Foundation_Predicate<DefaultHistoryTransaction>) | null): HistoryDescriptor<DefaultHistoryTransaction>
Swift declaration
init(predicate: Predicate<TransactionType>? = nil)
get · iOS 18.0+

changeIdentifier

TypeScript
get changeIdentifier(): number
Swift declaration
let changeIdentifier: DefaultHistoryDelete<Model>.ChangeIdentifier
get · iOS 18.0+

transactionIdentifier

TypeScript
get transactionIdentifier(): number
Swift declaration
let transactionIdentifier: DefaultHistoryDelete<Model>.TransactionIdentifier
get · iOS 18.0+

changedPersistentIdentifier

TypeScript
get changedPersistentIdentifier(): PersistentIdentifier
Swift declaration
let changedPersistentIdentifier: PersistentIdentifier
get · iOS 18.0+

tombstone

TypeScript
get tombstone(): HistoryTombstone<SDKHandle>
Swift declaration
let tombstone: HistoryTombstone<Model>
get · iOS 18.0+

changeIdentifier

TypeScript
get changeIdentifier(): number
Swift declaration
let changeIdentifier: DefaultHistoryInsert<Model>.ChangeIdentifier
get · iOS 18.0+

transactionIdentifier

TypeScript
get transactionIdentifier(): number
Swift declaration
let transactionIdentifier: DefaultHistoryInsert<Model>.TransactionIdentifier
get · iOS 18.0+

changedPersistentIdentifier

TypeScript
get changedPersistentIdentifier(): PersistentIdentifier
Swift declaration
let changedPersistentIdentifier: PersistentIdentifier
get · iOS 18.0+

changeIdentifier

TypeScript
get changeIdentifier(): number
Swift declaration
let changeIdentifier: DefaultHistoryUpdate<Model>.ChangeIdentifier
get · iOS 18.0+

updatedAttributes

TypeScript
get updatedAttributes(): Array<(SDKHandle) & (SDKHandle)>
Swift declaration
let updatedAttributes: [any PartialKeyPath<Model> & Sendable]
get · iOS 18.0+

transactionIdentifier

TypeScript
get transactionIdentifier(): number
Swift declaration
let transactionIdentifier: DefaultHistoryUpdate<Model>.TransactionIdentifier
get · iOS 18.0+

changedPersistentIdentifier

TypeScript
get changedPersistentIdentifier(): PersistentIdentifier
Swift declaration
let changedPersistentIdentifier: PersistentIdentifier
get · iOS 17.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.

get · iOS 17.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

The collection's "past the end" position---that is, the position one greater than the last valid subscript argument. When you need a range that includes the last element of a collection, use the half-open range operator (`..<`) with `endIndex`. The `..<` operator creates a range that doesn't include the upper bound, so it's always safe to use with `endIndex`. For example: let numbers = [10, 20, 30, 40, 50] if let index = numbers.firstIndex(of: 30) { print(numbers[index ..< numbers.endIndex]) } // Prints "[30, 40, 50]" If the collection is empty, `endIndex` is equal to `startIndex`.

subscript · iOS 17.0+

subscript

TypeScript
subscript(position: number): unknown
Swift declaration
subscript(position: Int) -> Element { get }

Accesses the element at the specified position. The following example accesses an element of an array through its subscript to print its value: var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] print(streets[1]) // Prints "Bryant" You can subscript a collection with any valid index other than the collection's end index. The end index refers to the position one past the last element of a collection, so it doesn't correspond with an element. - Parameter position: The position of the element to access. `position` must be a valid index of the collection that is not equal to the `endIndex` property. - Complexity: O(1)

get · iOS 18.0+

stringValue

TypeScript
getStringValue($self: Schema_Index_CodingKeys): string
Swift declaration
var stringValue: String { get }

The string to use in a named collection (e.g. a string-keyed dictionary).

get · iOS 18.0+

intValue

TypeScript
getIntValue($self: Schema_Index_CodingKeys): (number) | null
Swift declaration
var intValue: Int? { get }

The value to use in an integer-indexed collection (e.g. an int-keyed dictionary).

get · iOS 18.0+

originalName

TypeScript
get originalName(): string
Swift declaration
final var originalName: String { get set }
set · iOS 18.0+

originalName

TypeScript
set originalName(value: string)
Swift declaration
final var originalName: String { get set }
get · iOS 18.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 18.0+

name

TypeScript
get name(): string
Swift declaration
final var name: String { get set }
set · iOS 18.0+

name

TypeScript
set name(value: string)
Swift declaration
final var name: String { get set }
get · iOS 18.0+

indices

TypeScript
get indices(): Array<Schema_Index_Types<SDKHandle, SDKHandle>>
Swift declaration
final let indices: [Schema.Index<T>.Types<T>]
get · iOS 18.0+

isUnique

TypeScript
get isUnique(): boolean
Swift declaration
final var isUnique: Bool { get }
get · iOS 18.0+

isUnique

TypeScript
get isUnique(): boolean
Swift declaration
final var isUnique: Bool { get }
get · iOS 18.0+

stringValue

TypeScript
getStringValue($self: Schema_Unique_CodingKeys): string
Swift declaration
var stringValue: String { get }

The string to use in a named collection (e.g. a string-keyed dictionary).

get · iOS 18.0+

intValue

TypeScript
getIntValue($self: Schema_Unique_CodingKeys): (number) | null
Swift declaration
var intValue: Int? { get }

The value to use in an integer-indexed collection (e.g. an int-keyed dictionary).

get · iOS 18.0+

originalName

TypeScript
get originalName(): string
Swift declaration
final var originalName: String { get set }
set · iOS 18.0+

originalName

TypeScript
set originalName(value: string)
Swift declaration
final var originalName: String { get set }
get · iOS 18.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 18.0+

name

TypeScript
get name(): string
Swift declaration
final var name: String { get set }
set · iOS 18.0+

name

TypeScript
set name(value: string)
Swift declaration
final var name: String { get set }

Skipped declarations

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

ModelConfiguration.init(for:isStoredInMemoryOnly:)

Passing a Swift type itself is not supported.

DefaultStore.fetch(_:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

DefaultStore.fetchCount(_:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

DefaultStore.fetchIdentifiers(_:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

DefaultStore.delete(_:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

DefaultStore.historyType

Passing a Swift type itself is not supported.

ModelActor.modelContext

The iOS SDK compiler rejected this binding: actor-isolated property 'modelContext' can not be referenced from a nonisolated context

DefaultSerialModelExecutor.enqueue(_:)

The iOS SDK compiler rejected this binding: instance method 'arg' requires that 'ExecutorJob' conform to 'Copyable'

ModelActor.subscript(_:as:)

Passing a Swift type itself is not supported.

ModelContainer.migrationPlan

Passing a Swift type itself is not supported.

ModelContainer.init(for:migrationPlan:configurations:)

Passing a Swift type itself is not supported.

ModelContainer.init(for:migrationPlan:configurations:)

A variable number of Swift arguments is not supported.

ModelContainer.init(for:configurations:)

Passing a Swift type itself is not supported.

ResultsSection.subscript(_:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.sectionBy

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.element(at:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.indexPath(for:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(fetchDescriptor:modelContext:isolation:)

The containing type needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(filterBy:sortBy:modelContext:isolation:)

The containing type needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(fetchDescriptor:modelContainer:isolation:)

The containing type needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(filterBy:sortBy:modelContainer:isolation:)

The containing type needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(fetchDescriptor:sectionBy:modelContext:isolation:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(filterBy:sortBy:sectionBy:modelContext:isolation:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(fetchDescriptor:sectionBy:modelContainer:isolation:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(filterBy:sortBy:sectionBy:modelContainer:isolation:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(fetchDescriptor:sectionBy:modelContext:isolation:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(filterBy:sortBy:sectionBy:modelContext:isolation:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(fetchDescriptor:sectionBy:modelContainer:isolation:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

ResultsObserver.init(filterBy:sortBy:sectionBy:modelContainer:isolation:)

This declaration needs Swift generic type arguments. (no canonical witness for Element)

DataStoreFetchResult.init(descriptor:fetchedSnapshots:relatedSnapshots:)

The containing type needs Swift generic type arguments. (no canonical witness for ModelType)