Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
At a minimum, each document instance inherits two core responsibilities: to produce its actual document data on demand and to update itself to new data in response to iCloud refreshes. When you subclass UIDocument, you must implement two methods. Recipe 18-2 presents the barest-bones document subclass that you might create:
• The loadFromContents:error: method brings new content to the class, allowing it to update its internal data. When it receives its new data, it pings an informal delegate to let it know that it’s a good time to reload the image.
• The contentsForType :error: method gets called whenever the user saves data locally. Here, you produce a data representation of your document that can be stored to the cloud, allowing you to publish that data ubiquitously.