How to check valid Date() in Swift
<p>How to check if the date is valid, before making a SQL query  using</p>

<pre><code>request.predicate = NSPredicate (format: "% @ &lt;= AND myDate% @&gt; = myDate" startDate, endDate)
</code></pre>

<p>an error occurs with the leap years, like 30 of February 2016.</p>

<pre><code>// code form comment...
let startDate:NSDate = dateFormatter.dateFromString("2016-10-01")!
let endDate:NSDate = dateFormatter.dateFromString("2016-10-29")!
</code></pre>