title: NSCalendar in Swift - init can return nil, but isn't optional
body: <p><code>NSCalendar(calendarIdentifier: calendarName)</code> can return <code>nil</code> if <code>calendarName</code> is not valid - this is the original Objective-C behaviour, and is also true in Swift. However, it appears that the compiler believes the initializer returns an <code>NSCalendar</code> rather than an <code>NSCalendar?</code>, as follows:</p>
  
  <pre><code>let c1 = NSCalendar(calendarIdentifier: "gregorian")// _NSCopyOnWriteCalendarWrapper
  let c2 = NSCalendar(calendarIdentifier: "buddhist")// _NSCopyOnWriteCalendarWrapper
  
  //let c3:NSCalendar = NSCalendar(calendarIdentifier: "rubbish") // run-time error
  let c3:NSCalendar? = NSCalendar(calendarIdentifier: "rubbish") // nil
  </code></pre>
  
  <p>So if the initializer can return nil, my understanding is that I should be able to do</p>
  
  <pre><code>if let c4 = NSCalendar(calendarIdentifier: "rubbish") as? NSCalendar { 
      //error: conditional downcast from 'NSCalendar' to 'NSCalendar' always succeeds
  }
  </code></pre>
  
  <p>However, this is a compile-time error as shown.</p>
  
  <p>What am I misunderstanding here, and how can I safely test that a named calendar actually exists?</p>