MapboxSearchController
public class MapboxSearchController : UIViewController
extension MapboxSearchController: SearchEngineDelegate
Provides built-in location search functionality powered by Mapbox
-
Custom search bar placeholder
Declaration
Swift
public var searchBarPlaceholder: String? { get set } -
Provider of customer’s favorite records
Declaration
Swift
public var favoritesProvider: FavoritesProvider -
Provider of recent searches
Declaration
Swift
public var historyProvider: HistoryProvider -
Actual
CategorySearchEngineused for category search requestsDeclaration
Swift
public var categorySearchEngine: CategorySearchEngine -
Actual
SearchEngineused for query-based searchesDeclaration
Swift
public var searchEngine: SearchEngine { get set } -
Options used to customize search, nil by default.
Declaration
Swift
public var searchOptions: SearchOptions? -
Options used to customize category search, nil by default.
Declaration
Swift
public var categorySearchOptions: SearchOptions? -
Structure to configure MapboxSearchController UI and logic
Declaration
Swift
public var configuration: Configuration { get set } -
The object that the search controller calls with the result of user actions
Declaration
Swift
public weak var delegate: SearchControllerDelegate? -
Instantiate MapboxSearchController with explicit accessToken and custom location provider
Declaration
Swift
@available(*, deprecated, message: "Specify ApiType explicitly instead.") public convenience init( accessToken: String? = nil, configuration: Configuration = Configuration())Parameters
accessTokenMapbox public access token.
configurationconfiguration for search and categorySearch engines.
-
Instantiate MapboxSearchController with explicit accessToken and custom location provider
Declaration
Swift
public required init( apiType: ApiType, accessToken: String?, configuration: Configuration = Configuration())Parameters
apiTypeSpecifies which API provider to use through this search feature.
accessTokenMapbox public access token.
configurationconfiguration for search and categorySearch engines.
-
MapboxSearchController initializer with accessToken taken from application Info.plist
Access token is expected to be at
MBXAccessTokenkey in application Info.plist. Missing accessToken will trigger fatalErrorDeclaration
Swift
public required init( apiType: ApiType, configuration: Configuration = Configuration() )Parameters
apiTypeSpecifies which API provider to use through this search feature.
configurationconfiguration for search and categorySearch engines.
-
Make initial UI
Declaration
Swift
override public func viewDidLoad() -
Restart listening services on screen appearance
Declaration
Swift
override public func viewWillAppear(_ animated: Bool) -
Pause listening services on screen disappearance
Declaration
Swift
override public func viewDidDisappear(_ animated: Bool) -
Presentation styles for MapboxSearchController. Non-animated
See moreDeclaration
Swift
public enum PresentationStyle -
Get access to the
MapboxPanelControllerfor.panelpresentation styleDeclaration
Swift
public var panelController: MapboxPanelController? { get } -
Show Mapbox Search Controller inside of target view controller
Declaration
Swift
public func present(in rootVC: UIViewController, presentationStyle: PresentationStyle = .panel)Parameters
rootVCViewController to be root of Search Controller
presentationStyleChoose one of the presentation styles. Default is
.panel -
Reset MapboxSearchController state recursively
Declaration
Swift
public func resetSearchUI(animated: Bool, collapse: MapboxPanelController.State? = .collapsed)Parameters
animatedShould changes be animated
collapseChange the collapsing status. Pass
nilto not apply status changes. Default:.collapsed
-
Update suggestion table or show empty suggestions view.
Declaration
Swift
public func suggestionsUpdated(suggestions: [SearchSuggestion], searchEngine: SearchEngine) -
Declaration
Swift
public func offlineResultsUpdated( _ results: [SearchResult], suggestions: [SearchSuggestion], searchEngine: SearchEngine ) -
Preserve result in the
historyProviderand pass object to thedelegate.Declaration
Swift
public func resultResolved(result: SearchResult, searchEngine: SearchEngine) -
Display search error on results table view.
Declaration
Swift
public func searchErrorHappened(searchError: SearchError, searchEngine: SearchEngine)
MapboxSearchController Class Reference