I need a way of comparing two CLLocationCoordinate2D‘s however when I tried using == it wouldn’t work. Please can someone help me out with the best way of comparing them?
I need a way of comparing two CLLocationCoordinate2D ‘s however when I tried using
Share
Either the generic approach for comparing two instances of any given struct type:
or
should work, if you really want to be sure they’re exactly equal. However, given that latitude and longitude are defined as doubles, you might really want to do a “close enough” comparison:
where
epsilonis whatever level of error you want to accept.