title: Creating an NSDateFormatter in Swift?
body: <p>I am new to swift and am very unfamiliar with Objective-C. Could someone help me convert this to Swift? I got this code from Ray Wenderlich's best iOS practices - <a href="http://www.raywenderlich.com/31166/25-ios-app-performance-tips-tricks" rel="noreferrer">http://www.raywenderlich.com/31166/25-ios-app-performance-tips-tricks</a></p>
  
  <p>Where would you put this code? Would it go in a class file full of global variables?</p>
  
  <pre><code>- (NSDateFormatter *)formatter {
      static NSDateFormatter *formatter;
      static dispatch_once_t onceToken;
      dispatch_once(&amp;onceToken, ^{
          _formatter = [[NSDateFormatter alloc] init];
          _formatter.dateFormat = @"EEE MMM dd HH:mm:ss Z yyyy"; // twitter date format
      });
      return formatter;
  }
  </code></pre>