Mac Developer Library

Developer

MapKit Framework Reference MKPlacemark Class Reference

Options
Deployment Target:

On This Page
Language:

MKPlacemark

Inheritance


Import Statement


Swift

import MapKit

Objective-C

@import MapKit;

Availability


Available in OS X v10.9 and later.

A MKPlacemark object stores placemark data for a given latitude and longitude. Placemark data includes information such as the country, state, city, and street address associated with the specified coordinate. You can initialize a placemark using the initWithPlacemark: inherited method or the initWithCoordinate:addressDictionary: method specifying a coordinate and address dictionary.

A placemark is also an annotation and conforms to the MKAnnotation protocol, whose properties and methods include the placemark coordinate and other information. Because they are annotations, you can add them directly to the map view.

  • Initializes and returns a placemark object using the specified coordinate and Address Book dictionary.

    Declaration

    Swift

    init!(coordinate coordinate: CLLocationCoordinate2D, addressDictionary addressDictionary: [NSObject : AnyObject]!)

    Objective-C

    - (instancetype)initWithCoordinate:(CLLocationCoordinate2D)coordinate addressDictionary:(NSDictionary *)addressDictionary

    Parameters

    coordinate

    The map coordinate to associate with the placemark.

    addressDictionary

    A dictionary containing keys and values from an Address Book record. For a list of strings that you can use for the keys of this dictionary, see the “Address Property” constants in ABPerson Reference. All of the keys in should be at the top level of the dictionary.

    Return Value

    An initialized MKPlacemark object.

    Discussion

    You can create placemark objects manually for entities for which you already have address information, such as contacts in the Address Book. Creating a placemark object explicitly avoids the need to query the reverse geocoder object for the same information.

    Import Statement

    Objective-C

    @import MapKit;

    Swift

    import MapKit

    Availability

    Available in OS X v10.9 and later.

  • The abbreviated country name. (read-only)

    Declaration

    Swift

    var countryCode: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *countryCode

    Discussion

    This string is the standard abbreviation used to refer to the country. For example, if the placemark location was Apple’s headquarters, the value for this property would be the string “US”.

    Import Statement

    Objective-C

    @import MapKit;

    Swift

    import MapKit

    Availability

    Available in OS X v10.9 and later.