Swift 3.0 - Broken func value(for component: Calendar.Component) -> Int?
问题 Is there a workaround for value(for component: Calendar.Component) seemingly being broken? Or a dynamic way to call the property version? func dateComponentsValueShouldBeNil() { let dateComponents = DateComponents(month: 3) debugPrint("Month", dateComponents.month) // "Month" Optional(3) debugPrint("Property", dateComponents.hour) // "Property" nil debugPrint("Enumeration", dateComponents.value(for: .hour)) // "Enumeration" Optional(9223372036854775807) } 回答1: Non-defined date components in a