A managed document object that integrates with Core Data.
- iOS 5.0+
- Mac Catalyst 13.0+
UIManaged is a concrete subclass of
UIDocument. When you initialize a managed document, you specify the URL for the document location. The document object then creates a Core Data stack to use to access the document’s persistent store using a managed object model from the app’s main bundle.
UIManaged performs all the basic setup you need for Core Data, and in some cases you may use instances of the class directly (without a need to subclass). You can supply configuration options for the creation of the coordinator using
persistent, and for the model using
model. You can also perform additional customization by creating a subclass of
persistentto customize the name of the persistent store file inside the document’s file package.
managedto customize creation of the managed object model.
You do this if, for example, your app supports multiple document types, each of which uses a different model. You want to ensure that the models are not merged for each document class.
persistentto customize the type of persistent store used by a document.
Store Type(for File Type:)
configureto customize the loading or creation of a persistent store.
Persistent Store Coordinator(for: of Type: model Configuration: store Options:)
To enable your app to observe and handle errors in saving and validating a managed document, you must subclass the
UIManaged class and override one or both of the following two inherited methods from the
Overriding is required because otherwise, the only information your app receives on error is the
state notification, which does not contain a
user dictionary and so does not convey specific error information.