In answering another question on SO, I found that the CLLocation class conforms to the Equatable protocol. What method does it use to determine equality?
Exact match of lat/long? Exact match of lat/long and altitude? Exact match of latitude, longitude, altitude, and timestamp? What about speed and course? What about CLLocation objects that were created with only a lat/long pair? Various other values of the location are not optionals, so what would the altitude be for a location created using init(latitude:longitude:)?
Just fully verify what JAL has said in his answer, I wrote:
Then I command clicked on the
==(fromif cl1 == cl2). It took me to:To double check I command clicked on
CLLocationand saw:So basically the
==is because it's subclassed fromNSObjectwhich only compares references.