I went through the last challenge of the chapter and I still have this question:
So, I have an NSApplication object that is responsible for the app as a whole. During the loading of the app, NSApplication then calls up the main xib file of the project and sends an init message to all the objects declared in it, creating an instance of them.
Let’s take the official solution for the ToDoList challenge. In there I have an App Delegate, which is created by default, and I have a ToDo Controller, which I created myself. To create an instance of the To Do controller, I drag an NSObject from the Cocoa library to the dock in the Interface Builder. It creates an instance and the code works fine
My question is, how can I access the ToDo Controller object from other parts of the code? For example, let’s say I have a method in the ToDo Controller that I want to call from the App Delegate, is there anyway I can pass a message to the ToDo Controller from the App Delegate?
[[NSApplication ToDoController] doMyMethod]; ??