Class

MKLocalSearchRequest

The parameters to use when searching for points of interest on the map.

Overview

You create an MKLocalSearchRequest object when you want to search for map locations based on a natural language string. For example, if your interface allows the user to type in addresses, you would place the typed text in this object and pass it to an MKLocalSearch object to begin the search process. When specifying your search strings, include a map region to narrow the search results to the specified geographical area.

When creating an MKLocalSearchRequest object yourself, set the naturalLanguageQuery property to an appropriate search string, as in the following example:

let request = MKLocalSearchRequest()
request.naturalLanguageQuery = "coffee"
 
// Set the region to an associated map view's region
request.region = myMapView.region

If your app uses an MKLocalSearchCompleter object to implement auto-complete support for user-supplied search strings, initialize your search request using the search completion selected by the user. In that case, use the init(completion:) method to initialize your search request object instead of the init() method. The completion object automatically provides the value for the naturalLanguageQuery property.

Topics

Initializing a Local Search Request

init(completion: MKLocalSearchCompletion)

Initializes and returns a search request based on the specified search completion data.

Configuring the Search Parameters

var naturalLanguageQuery: String?

A string containing the desired search item.

var region: MKCoordinateRegion

A map region that provides a hint as to where to search.

Relationships

Inherits From

See Also

Placemark Search

class MKLocalSearch

A utility object for initiating map-based searches and processing the results.

class MKLocalSearchResponse

The results from a map-based search.

class MKLocalSearchCompleter

A utility object for generating a list of completion strings based on a partial search string that you provide.

class MKLocalSearchCompletion

A fully formed string that completes a partial string.