ios - How does CLLocation implement the Equatable protocol? -
in answering question on so, found cllocation
class conforms equatable
protocol. method use determine equality?
exact match of lat/long? exact match of lat/long , altitude? exact match of latitude, longitude, altitude, , timestamp? speed , course? cllocation
objects created lat/long pair? various other values of location not optionals, altitude location created using init(latitude:longitude:)
?
how
cllocation
implement equatable protocol?
it doesn't. there no overridden ==
function compares 2 cllocation
instances. when calling ==
2 cllocation
instances, nsobject
==
function used:
public func ==(lhs: nsobject, rhs: nsobject) -> bool
to compare 2 cllocation
instances, either compare properties on each care (latitude or longitude), or use built in distance(from:)
method 2 locations , compare cllocationdistance
threshold.
Comments
Post a Comment