Search SDK for iOS

Search for places by category

This example does not contain a UI. Results will be printed to the Xcode console.

import UIKit
import MapboxSearch
class SimpleCategorySearchViewController: UIViewController {
let searchEngine = CategorySearchEngine()
// let searchEngine = CategorySearchEngine(accessToken: "<#You can pass access token manually#>")
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated) "cafe") { (response) in
do {
let results = try response.get()
print("Number of category search results: \(results.count)")
for result in results {
print("\tResult coordinate: \(result.coordinate)")
} catch {
print("Error during category search: \(error)")
Was this example helpful?