title: How to pass values between classes in objective C?
body: <p>I am currently stuck on figuring out why my values aren't passing in xcode. My code looks correct but for some reason it's not passing. </p>
  
  <p>Here is what TheView.h looks like</p>
  
  <pre><code>//View Header File
  #import &lt;UIKit/UIKit.h&gt;
  
  IB_DESIGNABLE
  @interface TheView : UIView
  @property NSString *dateTimeString;
  @end
  </code></pre>
  
  <p>and TheView.m </p>
  
  <pre><code>// m file of View
  #import "TheView.h"
  @implementation TheView
  
  // Display method here with dateTimeString in parems
  [DrawCanvas dateText: self.dateTimeString];
  
  @end
  </code></pre>
  
  <p>In my controller .h file, I have this code</p>
  
  <pre><code>// Controller File
  #import "TheView.h"
  
  @interface MainViewController: UIViewController
  @property (weak, nonatomic) IBOutlet TheView *rootView;
  
  @end
  </code></pre>
  
  <p>MainViewController .m file</p>
  
  <pre><code>#import "MainViewController.h"
  #import "TheView.h"
  
  @interface MainViewController ()
  @property (string, nonatomic) NSTimer *currentTime;
  @end
  
  @implementation MainViewController
  
  -(void)updateTime
  {
    // prints date successfully
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSLocale time = [[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"];
    dateFormatter.locale = time;
    formatString = [NSDATEFORMATTER dateFormatFromTemplate:@"EEEE, hh:mm" options:0 locale:[NSLocale currentLocale]];
  
    [dateFormatter setDateFormat:formatString];
    NSString *resultString = [dateFormatter stringFromDate:[NSDate date]];
  
    // Current issue is that it isn't passed from here to TheView.m
    [_rootView setdateTimeString:resultString];
  }
  </code></pre>
  
  <p>From what I understand in the debug, the string from controller is giving the result I need but it's just not setting the value.</p>
  
  <p>If it helps this code is called viewWillAppear so it will call the updateTime method and won't be nil in theory. </p>