This Swift 3 code worked until XCode 8 beta 3:
let calendar = Calendar.current
let anchorComponents = calendar.components([Calendar.Unit.day, Calendar.Unit.month, Calendar.Unit.year, Calendar.Unit.hour], from: self)
In Xcode 8 beta 4 Calendar.Unit
appears to be renamed to Calendar.Component
.
Now this code
let calendar = Calendar.current
let anchorComponents = calendar.components([Calendar.Component.day, Calendar.Component.month, Calendar.Component.year, Calendar.Component.hour], from: self)
produces the compiler error cannot convert value of type Calendar.Component to NSCalendar.Unit
Am I doing anything wrong or is this a bug?
self
by a proper date object. – Haslam