Instance Method
isDate(_:equalTo:toGranularity:)
iOS 8.0+
iPadOS 8.0+
Mac Catalyst 8.0+
macOS 10.10+
tvOS 9.0+
watchOS 2.0+
Returns a Boolean value indicating whether two dates are equal in the given component and all larger components.
func isDate(_ date1: Date, equalTo date2: Date, toGranularity component: Calendar.Component) -> Bool
Parameters
date1A date to compare.
date2A date to compare.
componentA granularity to compare. For example, pass
.hourto check if two dates are in the same hour.
Return Value
true if the given date is within tomorrow.