2015-10-08 start of a day with NSDate

There's a nice new function since iOS 9, startOfDayForDate. Some examples:

To get the NSDate for this morning:

 Calendar.current.startOfDay(for: Date())

And to get the end of the previous day:

 let thisMorning = Calendar.current.startOfDay(for: Date())
 let yesterdayEvening = Calendar.current.date(byAdding: .second, value: -1, to: thisMorning)

And since iOS 8, there's isDateInToday. For example:

 if Calendar.current.isDateInToday(flight.departureDate) {
     ....
 }