NSDateComponents to NSDate - Swift
问题 I have this function : private func getCurrentDateComponent() -> NSDateComponents { let date = NSDate() let calendar = NSCalendar.currentCalendar() let components = calendar.components(.CalendarUnitHour | .CalendarUnitMinute | .CalendarUnitMonth | .CalendarUnitYear | .CalendarUnitDay, fromDate: date) return components } When I call it and I use the function date var d = this.getCurrentDateComponent().date I don't know why the variable d is nil... Thank you for your help Ysee 回答1: That's how I