NSObject is a Cocoa bindings-compatible controller class. Properties of the content object of instances of this class can be bound to user interface elements to access and modify their values.
- macOS 10.3+
By default, the content of an
NSObject instance is an
NSMutable object. This allows a single
NSObject instance to be used to manage many different properties referenced by key-value paths. The default content object class can be changed by calling
object, which subclasses must override. Your application should use a custom data class that is key-value compliant whenever possible.
Object Controllers, Entity Mode, and Lazy Fetching
NSObject and its subclasses, when in entity mode, can now fetch lazily. With lazy fetching enabled using the property
uses, the controller will try to fetch only a small amount of data from available persistent stores. This can provide a significant improvement in memory use when a large amount of content is stored on disk but just a subset of that data is required in memory.
When set to use lazy fetching, a controller will fetch objects in batches. You can change the default batch size for your application by setting a value for the the user default "
com". If you have table views bound to an array controller set to use lazy fetching, the size of the controller's batch size will grow as the table views' visible row count grows.
Add, Insert, and Remove operations on controllers that use lazy fetching behave similarly to the same operations on a regular controller. The difference is that it is faster to sort an array controller using lazy fetching if:
All of the keys in the
sortarray are modeled, non transient properties.
All of the selectors in the
There are no changes in the controller's managed object context