I am learning Cocoa and my understanding from reading the documentation is that when an application starts the following happens:
This is fine and makes sense for s single windowed application however I am confused by what xcode does when a document based application is created.
In this case there are two nib files; the first contains the application menu and the second contains the window which represents the NSDocument subclass. when I run the application a new document window is opened automatically.
Based on my understanding of how the application works outlined above I don't understand how my application knows to open the document window once the menu nib has been looked up from the property list. There is no code generated to do this as far as I can see (except for the windowNibName method but where is this called from?)
Can anyone tell me what xcode does differently so that the application knows that it is document based and therefore needs to open a document window?
Update:
What I am trying to understand is how Xcode knows how to do something different if my application is set up as a document based application rather than a single window application. As far as I am aware there is no setting to specify this and Xcode doesn't appear to generate any code to give this different behaviour.
From reading the documents over the last couple of days I think I know how this works but am not sure:
Hopefully any Cocoa experts can confirm if my understanding is correct or if I am barking up the wrong tree.
Boost user productivity and provide an excellent user experience by incorporating key Apple technologies, such as UIDocument, Open in Place, Document Provider Extension, and iCloud Drive, into your document-based app.
A document-based app is just going to be an app which manages a list of these documents and presents them to the users so that they can view them or edit them or rename them. Keynote, for example, manages a list of Keynote presentation documents.
When you create a document-based application, you get a few things:
When your app opens, the shared NSDocumentController will create a new untitled document using the CFBundleDocumentTypes information.
For more information, read The Document-Based Application Project Template and the rest of the document-based applications guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With