I do have 2 different tuples of type (Double, Double):
let tuple1: (Double, Double) = (1, 2)
let tuple2: (Double, Double) = (3, 4)
I want t
Swift 4 supports tuple comparison. You won't get the error anymore.
This code runs perfectly
let tuple1 : (Double, Double) = (1,2)
let tuple2 : (Double, Double) = (3,4)
if (tuple1 == tuple2) {
print("equal")
}
else {
print("unequal")
}
Here, unequal is printed in the console of the playground.
One limitation in tuple comparison as mentioned in the apple doc is -
The Swift standard library includes tuple comparison operators for tuples with fewer than seven elements. To compare tuples with seven or more elements, you must implement the comparison operators yourself.