isBefore(_ date: Date) -> Bool

Check if self is before input date.

Parameters

  • date: The date to compare to.

Returns

True if self is before input date, false otherwise.

let date = Date()
let futuredate = date.addingTimeInterval(1)
date.isBefore(futuredate)
// -> true