I was going through the sample example of MapKit and CoreLocation framework. I found these two structs (MKCoordinateSpan and CLLocationCoordinate2D) which are similar in declaration. How are these different in functionality, can someone please site an example (using both) to clear their meanings.
Thanks!
MKCoordinateSpandefines a span, i.e. a delta, in the latitude and longitude directions to show on a map. Along with a point you can then define a region to display on a map.CLLocationCoordinate2Ddefines a single point in the latitude and longitude coordinate system.For example:
Here you can imagine a centre point
(lat,lon)about which you have adeltaLatand adeltaLon.So
(lat,lon)would be aCLLocationCoordinate2DanddeltaLat, deltaLonwould form aMKCoordinateSpan.You’re right that both structures are defined in the same way, but this is quite common where the two different structures have different semantics and therefore are defined separately like you’ve found.