NSCalendarUnit.Type doesnt have a member named CalendarUnitWeekDay

时间:2015-06-26 09:35:15

标签: nscalendar swift2

let currentDayOfWeek = NSCalendar.currentCalendar().component(.CalendarUnitWeekday, fromDate: NSDate())

In this place I get an error:

NSCalendarUnit.Type doesnt have a member named CalendarUnitWeekDay

1 个答案:

答案 0 :(得分:0)

它没有Weekday,可以这样使用:

let calendar = NSCalendar.currentCalendar()
let component = calendar.component(.Weekday, fromDate:NSDate())