Tôi đã triển khai dự án đồng hồ của mình trong Swift và bây giờ tôi đang chuyển sang Swift 3 vì Xcode 8. Tôi để Xcode 8 thay đổi mã nguồn thành Swift 3. Tuy nhiên, có lỗi trong mã và Tôi không thể hình dung nó ra.Xcode 8 và Swift 3 NSCalendar
let unitFlags: Calendar = [.hour, .firstWeekday, .monthSymbols, .year, .minute, .firstWeekday]
var calendar = NSCalendar.current
calendar.timeZone = NSTimeZone(identifier: "UTC")!
let components = (calendar as NSCalendar).components(unitFlags, from: reservationDate)
Xcode cho lỗi trong các dòng này và tôi không thể hiểu được vấn đề.
ERROR: Contextual type ' Calendar' cannot be used with array literal
ERROR: Argument labels '(identifier:)' do not match any available overloads
ERROR: Cannot convert value of type 'Calendar' to expected argument type 'NSCalendar.Unit'