title: What am I doing wrong with NSDateComponentsFormatter?
body: <p>I recently found out about the new-to-iOS8 class NSDateComponentsFormatter, which lets you format time intervals rather than dates. Cool. I've written code to do this more times than I care to think about. So I decided to try and use it in a playground, but I can't get it to work. Here's my (Swift) code:</p>
  
  <pre><code>var componentsFormatter = NSDateComponentsFormatter()
  componentsFormatter.allowedUnits =
    .CalendarUnitHour |
    .CalendarUnitMinute |
    .CalendarUnitSecond
  
  componentsFormatter.unitsStyle = .Positional
  
  let interval: NSTimeInterval = 345.7
  
  let intervalstring = componentsFormatter.stringFromTimeInterval(interval)
  
  println("Interval as String = \(intervalstring)")
  </code></pre>
  
  <p>This displays </p>
  
  <blockquote>
    <p>Interval as String = nil</p>
  </blockquote>
  
  <p>I've tried various things, but no joy. Does anybody have a working example using this new class, or can you spot what I'm missing? </p>
  
  <p>(I speak Objective-C too, so if you have sample code in Objective-C that works as well.)</p>