Is this designation legal in Objective-C

CLLocationCoordinate2D coord = {latitude: 61.2180556, longitude: -149.9002778};
MKCoordinateSpan span = {latitudeDelta: 0.2, longitudeDelta: 0.2};
MKCoordinateRegion region = {coord, span};

What is it? Curly braces?

There should also be no CLLocationCoordinate2D * coord

I saw them at http://www.iphonedevsdk.com/forum/tutorial-discussion/39374-mkmapview-tutorial-using-latitude-longitude.html

It’s totally strange.

+3
source share
1 answer

This is the C99 initialization syntax "initializer" for initializing structures. (This has nothing to do with the Objective-C concept of “designated initializers” for classes.)

+6
source

All Articles