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


class Request : NSObject


You create an MKLocalSearch.Request 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 MKLocalSearch.Request 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.


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.

var pointOfInterestFilter: MKPointOfInterestFilter?

A filter that lists point of interest categories to include or exclude in search results.

var resultTypes: MKLocalSearch.ResultType

The types of items to include in the search results.

typealias MKLocalSearch.Request.ResultType

Options that indicate types of search results.



Inherits From

See Also

Creating a Search Request

init(request: MKLocalSearch.Request)

Initializes and returns a search object configured with the specified parameters.

struct MKLocalSearch.ResultType

Options that indicate types of search results.