A point of interest on the map.


class MKMapItem : NSObject


A map item includes a geographic location and any interesting data that might apply to that location, such as the address at that location and the name of a business at that address. You can also create a special MKMapItem object representing the user's current location.

Use this class to do the following:

  • Share map-related data with the Maps app.

  • Handle requests for directions that originate from the Maps app.

To display information in Maps, create an MKMapItem object with the information you want to display and call the openMaps(with:launchOptions:) method. Maps displays that location on the map and shows the information you provide.

If you implement a routing app, Maps provides you with two MKMapItem objects representing the start and end points. Use the information in those two objects to plot the route and generate directions.


Creating Map Items

class func forCurrentLocation() -> MKMapItem

Creates and returns a singleton map item object representing the device’s current location.

init(placemark: MKPlacemark)

Initializes and returns a map item object using the specified placemark object.

Accessing the Map Item Attributes

var placemark: MKPlacemark

The placemark object containing the location information.

var pointOfInterestCategory: MKPointOfInterestCategory?

The point of interest category for the map item.

var isCurrentLocation: Bool

A Boolean value indicating whether the map item represents the user’s current location.

var name: String?

The descriptive name associated with the map item.

var phoneNumber: String?

The phone number associated with a business at the specified location.

var url: URL?

The URL associated with the specified location.

var timeZone: TimeZone?

The time zone of the specified location.

Launching the Maps App

class func openMaps(with: [MKMapItem], launchOptions: [String : Any]?) -> Bool

Open the Maps app and display the specified map items.

func openInMaps(launchOptions: [String : Any]?) -> Bool

Open the Maps app and display this map item.

Serializing a Map Item

let MKMapItemTypeIdentifier: String

A constant indicating the type of a serialized map item.

Opening Items at Launch Time

Launch Options Dictionary Keys

Launch options to specify when opening map items in the Maps app.

Directions Mode Values

Strings representing the possible values of the MKLaunchOptionsDirectionsModeKey key.

See Also

Map Fundamentals

class MKMapView

An embeddable map interface, similar to the one provided by the Maps application.