Instance Method

openInMaps(launchOptions:)

Open the Maps app and display this map item.

Declaration

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

Parameters

launchOptions

Additional information that the Maps app can use to configure the map display. For example, you can use the launch options to specify the visible map region and the map type. For a list of keys you can put into this dictionary, see Launch Options Dictionary Keys.

This parameter may be nil.

Return Value

true if this map item was successfully opened by the Maps app, or false if there was an error.

Discussion

You use this method to pass the current map item to the Maps app. If your map item contains descriptive information about the location (such as a name or URL), the Maps app displays that information at the specified coordinate.

If you specify the MKLaunchOptionsDirectionsModeKey option in the launchOptions dictionary, the Maps app interprets that as an attempt to map from the user’s current location to the location specified by this map item.

If you do not include the MKLaunchOptionsMapCenterKey and MKLaunchOptionsMapSpanKey keys in your launchOptions dictionary, Maps constructs a region around the current item. It uses that region to set the visible portion of the map.

See Also

Launching the Maps App

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

Open the Maps app and display the specified map items.