title: Model object ownership and MVC in Cocoa / iOS / iPhone
body: <p>I'm trying to understand how to better implement the Model-View-Controller design pattern.</p>
  
  <p>What object should 'own' the Model object?  Should a single Controller instantiate (own) the Model object?  </p>
  
  <p>Here is an example scenario:</p>
  
  <p>I have a UITabbarController containing two UIViewControllers (controllerA and controllerB).  Obviously neither of these controllers own each other.  I have a Model object which contains some data and also performs some network activity.  Both controllerA and controllerB need to be able to make changes to the Model object.  controllerB needs to know when changes have been made to the Model object (either by controllerA or returned results from the network activity).  From recent reading:</p>
  
  <ul>
  <li>I need KVO between the Model object and controllerB?</li>
  <li>Should the Model object be a singleton? So that both controllers can modify it?</li>
  <li>In simpler apps, I've had the viewController own the Model object.  Is there any way for one controller to instantiate the Model object, but for other controllers to have write access to it?</li>
  <li>I've also read about using the app delegate to own the Model object, and allowing controllers access via the app delegate share instance.  This seems kind of ugly - using the app delegate singleton to globally access my Model object.  Wouldn't it be better to just make my Model object a singleton?</li>
  <li>I saw someone on SO give <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/54859-sharing-data-between-view-controllers-other-objects.html">this</a> link to iPhoneDevSDK, but the reasons for his method escape me.  Again, isn't this getting the app delegate involved for something that should be just a singleton?</li>
  </ul>
  
  <p>Mainly, is there any other way for two Controllers to access (write to) one Model, other than through the Model being a singleton?</p>
  
  <p>Also, when a Controller owns another Controller (eg in a UINavigationController when the root view controller instantiates another view controller to stack on top of itself), would the best method for sharing the Model be for the root view controller to instantiate the Model, and pass it to the next view controller before pushing it onto the nav stack)?</p>