Instance Method
dateInterval(of:start:interval:for:)
iOS 8.0+
iPadOS 8.0+
Mac Catalyst 8.0+
macOS 10.10+
tvOS 9.0+
watchOS 2.0+
Returns, via two inout parameters, the starting time and duration of a given calendar component that contains a given date.
func dateInterval(of component: Calendar.Component, start: inout Date, interval: inout TimeInterval, for date: Date) -> Bool
Parameters
componentA calendar component.
startUpon return, the starting time of the calendar component that contains the date.
intervalUpon return, the duration of the calendar component that contains the date.
dateThe specified date.
Return Value
true if the starting time and duration of a component could be calculated, otherwise false.
Discussion
See Also
range(of:for:)
See Also
dateInterval(of:for:)