I have been working on a clock app in Swift and with Xcode 6.3.2 the following code builds and runs just fine.
// Get current time
let date = NSDate()
let calendar = NSCalendar.currentCalendar()
let components = calendar.components(.CalendarUnitHour | .CalendarUnitMinute | .CalendarUnitSecond | .CalendarUnitNanosecond, fromDate: date)
let hour = components.hour % 12
let minute = components.minute
let second = components.second
let nanosecond = components.nanosecond
Could not find member 'CalendarUnitHour'
NSCalendarUnit names have changed in Swift 2.
Also, now we have to pass these arguments in an array, like this:
let components = calendar.components([.Hour, .Minute, .Second, .Nanosecond], fromDate: date)