Search SDK for iOS

Place Autocomplete

Private preview

The Place Autocomplete for iOS is in a private preview. Contact sales team if you are interested in the Place Autocomplete.

The Place Autocomplete returns place suggestions in response to user search queries, such as addresses, businesses and POIs. The Place Autocomplete will help you to implement such functionality in a few lines of code.

Place Autocomplete use cases

  1. Search by name. This use case allows users quickly search for a place by its name, results can be limited to a region and sorted by proximity.
  2. Search by coordinates. This use case allows users to search for places by the coordinate and pick appropriate from the returned suggestions.

We have a ready-made sample app that you can try in Xcode with Place Autocomplete and other scenarios. We encourage you to install and try it for yourself.

Full example of Place Autocomplete

Learn how to integrate the Place Autocomplete with MapKit and Search UI components in a sample app.


Installation guide

Before using any of Mapbox's Search products, you need to do some common installation steps. Please follow this guide, then continue with the steps below.

  1. The main entry-point class is called PlaceAutocomplete, you will need to instantiate this class first:
let placeAutocomplete = PlaceAutocomplete(accessToken: mapboxAccessToken)
  1. Retrieve autocomplete suggestions for the specified query. The function parameters will vary depending on the use case.
  • For the Search by name use case you will have to provide a String query:
let query = "Starbucks"
placeAutocomplete.suggestions(for: query) { result in ... }
  • For the Search by coordinates use case you will have to provide geographic position represented by the CLLocationCoordinate2D type:
let searchCoordinates: CLLocationCoordinate2D = prepareSearchCoordinates()
placeAutocomplete.suggestions(for: searchCoordinates) { result in ... }
  1. Process the Place Autocomplete response. The suggestions() function returns either error or suggestions list:
placeAutocomplete.suggestions(for: query) { result in
    switch result {
    case .success(let suggestions):
    case .failure(let error):
API Reference

For more information, see the full API reference for the iOS Search SDK.