iPhone proper usage of Application Delegate

Normally, you should only connect things to the app delegate if they:

  • Were created from the same NIB file as the app delegate (i.e. static UI elements in single window interfaces)
  • Are associated with application-level event handling that passes through the app delegate (like the menu item for the Preferences Window)

For everything else, you should create a singleton which manages access to them.

Jason Coco suggested routing through the Application Controller. In my programs I normally avoid this, as I think it puts too much responsibility at the top level -- I think things should self-manage where possible and that higher level management should only be used when there is a requirement for coordination between peer-level modules.

I'm not going link my own blog but if you Google me and singletons you'll probably find a post I wrote going into more detail.


Matt is a bit too modest. His posting on the subject is one of the best I have read, and deserves a link. http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html