title: NSDate from Swift 2.3 to Date from Swift 3 Conversion
body: <p>So I've just updated to Xcode 8 and converted my Swift 2.3 code to Swift 3, and Swift 3 just converted all <code>NSDate</code> to <code>Foundation.Date</code></p>
  
  <p>And I had an <code>extension</code> for <code>NSDate</code>, now called<code>Foundation.Date</code>, it looked like this:</p>
  
  <pre><code>extension NSDate
  {
    var firstDayOfTheMonth:NSDate
    {
       var date: NSDate?
       NSCalendar.currentCalendar().rangeOfUnit(.Month, startDate:&amp;date , interval: nil, forDate: self)
       return date!
    }
  }
  </code></pre>
  
  <p>And Swift 3 converted it to this:</p>
  
  <pre><code>extension Foundation.Date
  {
    var firstDayOfTheMonth:Foundation.Date
    {
       var date: Foundation.Date?
      (Calendar.current as NSCalendar).range(of: .month, start:&amp;date , interval: nil, for: self)
       return date!
    }
  }
  </code></pre>
  
  <p>The problem here is that Xcode suggests me to do this : <code>Cannot convert value of type 'Date?' to expected argument type 'NSDate?'</code> and to drop the <code>&amp;</code>.</p>
  
  <p>So, I change it and the function now looks like this:</p>
  
  <pre><code>extension Foundation.Date
  {
    var firstDayOfTheMonth:Foundation.Date
    {
       var date: Foundation.Date?
      (Calendar.current as NSCalendar).range(of: .month, start:date as NSDate?, interval: nil, for: self)
       return date!
    }
  }
  </code></pre>
  
  <p>But now Xcode says <code>Cannot convert value of type 'Date?' to type 'NSDate?' in coercion</code></p>
  
  <p>How can I make this work?</p>