I'm new to Objective C so this could be very stupid question. I was reading iOS Programming book and came upon this snippet of code:
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
CLLocationCoordinate2D loc = [userLocation coordinate]; // returns CLLocationCoordinate2D
...
}
I'm still learning Objective C, but shouldn't loc be a pointer? From what I understand you can only assign directly simple types like int and float. Here CLLocationCoordinate2D is a structure. And yet this doesn't work:
CLLocationCoordinate2D *loc = [userLocation coordinate];
// this throws error message
// Initializing 'CLLocationCoordinate2D *' with an expression of incompatible type 'CLLocationCoordinate2D'
So what's going on here and how can I learn more about pointers. Thanks!