title: How to access view controller variables from the app delegate... and vice versa?
body: <p>I would like the view controller to be able to access <code>dog</code> in the app delegate.</p>
  
  <p>I would like the app delegate to be able to access <code>mouse</code> in the view controller.</p>
  
  <hr>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface ViewController : UIViewController
  {
      int mouse;  // &lt;----------------
  }
  @end
  </code></pre>
  
  <hr>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      mouse = 12;  // &lt;-------------------
  
      NSLog(@"viewDidLoad %d", dog); // &lt;---------------
  }
  </code></pre>
  
  <hr>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @class ViewController;
  
  @interface AppDelegate : UIResponder &lt;UIApplicationDelegate&gt;
  {
      int dog;  // &lt;---------------
  }
  @property (strong, nonatomic) UIWindow *window;
  
  @property (strong, nonatomic) ViewController *viewController;
  
  @end
  </code></pre>
  
  <hr>
  
  <pre><code>- (void)applicationWillResignActive:(UIApplication *)application
  {
      NSLog(@"applicationWillResignActive %d", mouse); // &lt;--------------
  }
  </code></pre>
  
  <hr>
  
  <pre><code> - (void)applicationDidBecomeActive:(UIApplication *)application
  {
      dog = 77; // &lt;---------------------
  
      NSLog(@"applicationDidBecomeActive");
  }
  </code></pre>