hasChanges
TypeScriptget hasChanges(): booleanSwift declarationvar hasChanges: Bool { get }class · iOS 17.0+ · SDK 27.1
class ModelContextAn object that enables you to fetch, insert, and delete models, and save any changes to disk.
get hasChanges(): booleanSwift declarationvar hasChanges: Bool { get }transaction(block: (() => void)): voidSwift declarationfunc transaction(block: () throws -> Void) throwsget undoManager(): (_Foundation_UndoManager) | nullSwift declarationvar undoManager: UndoManager? { get set }set undoManager(value: (_Foundation_UndoManager) | null)Swift declarationvar undoManager: UndoManager? { get set }get editingState(): EditingStateSwift declarationvar editingState: EditingStateset editingState(value: EditingState)Swift declarationvar editingState: EditingStatefetchHistory(descriptor: HistoryDescriptor<DefaultHistoryTransaction>): Array<DefaultHistoryTransaction>Swift declarationfunc fetchHistory<T>(_ descriptor: HistoryDescriptor<T>) throws -> [T] where T : HistoryTransactiondeleteHistory(descriptor: HistoryDescriptor<DefaultHistoryTransaction>): voidSwift declarationfunc deleteHistory<T>(_ descriptor: HistoryDescriptor<T>) throws where T : HistoryTransactionget autosaveEnabled(): booleanSwift declarationvar autosaveEnabled: Bool { get set }set autosaveEnabled(value: boolean)Swift declarationvar autosaveEnabled: Bool { get set }get changedModelsArray(): Array<SDKHandle>Swift declarationvar changedModelsArray: [any PersistentModel] { get }get deletedModelsArray(): Array<SDKHandle>Swift declarationvar deletedModelsArray: [any PersistentModel] { get }get insertedModelsArray(): Array<SDKHandle>Swift declarationvar insertedModelsArray: [any PersistentModel] { get }processPendingChanges(): voidSwift declarationfunc processPendingChanges()save(): voidSwift declarationfunc save() throwsmodel(persistentModelID: PersistentIdentifier): SDKHandleSwift declarationfunc model(for persistentModelID: PersistentIdentifier) -> any PersistentModelget author(): (string) | nullSwift declarationvar author: String? { get set }set author(value: (string) | null)Swift declarationvar author: String? { get set }static get didSave(): _Foundation_NSNotification_NameSwift declarationstatic let didSave: Notification.Namerollback(): voidSwift declarationfunc rollback()static get willSave(): _Foundation_NSNotification_NameSwift declarationstatic let willSave: Notification.Nameget container(): ModelContainerSwift declarationvar container: ModelContainer { get }static init(container: ModelContainer): ModelContextSwift declarationinit(_ container: ModelContainer)10 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
ModelContext.registeredModel(for:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
ModelContext.insert(_:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
ModelContext.delete(model:where:includeSubclasses:)
Passing a Swift type itself is not supported.
ModelContext.delete(_:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
ModelContext.enumerate(_:batchSize:allowEscapingMutations:block:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
ModelContext.fetch(_:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
ModelContext.fetchCount(_:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
ModelContext.fetch(_:batchSize:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
ModelContext.fetchIdentifiers(_:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
ModelContext.fetchIdentifiers(_:batchSize:)
This declaration needs Swift generic type arguments. (no canonical witness for T)