I'm updating my app to Swift 3.0 syntax (I know it's still in beta but I want to be prepared as soon as it released).
Until the previous Beta of Xcode (Beta 5) I was able to compare two Date
objects using the operands <
, >
and ==
. But in the latest beta (Beta 6) this isn't working any more. Here are some screenshots:
As you can see in both screenshots, these are two Date
objects. But I get the following error:
What am I doing wrong? The functions are still declared in the Date
class:
static func >(Date, Date)
Returns true if the left hand Date is later in time than the right hand Date.
Is this just a Beta bug or am I doing something wrong?
I have tried this snippet (in Xcode 8 Beta 6), and it is working fine.
let date1 = Date()
let date2 = Date().addingTimeInterval(100)
if date1 == date2 { ... }
else if date1 > date2 { ... }
else if date1 < date2 { ... }