HybridSearchFactory
public enum HybridSearchFactory
This is the factory for accessing the implementations for the Hybrid Search APIs provided via the Search protocol.
The Hybrid Search module wraps online and offline search modules that conform to the Search protocol.
It orchestrates how the SDK uses the two services to improve the reliability of the Search functionality.
An example usage:
// Create and store a Hybrid Search instance.
self.search = try HybridSearchFactory.create(apiKey: "YOUR_TOMTOM_API_KEY", store: store)
// Perform a search operation.
let options = SearchOptions(query: "pizza")
search.search(options) { result in /* Here you do processing */ }
Note
for more details, see theSearch documentation.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Creates a hybrid search with the geopolitical view set in
store.Throws
Throws an error ifNDSStoreis invalid.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public static func create( apiKey: String, store: NDSStore, timeout: Measurement<UnitDuration> = .tt.seconds(5), customPOIProviders: [CustomPOIProvider] = [], customAPIURL: URL? = nil ) throws -> SearchParameters
apiKeyAPI key for the online search.
storeNDSStore offline map handle. Additionally,
NDSStoredefines the overall geopolitical view for both online and offline inHybridSearch. Configure the corresponding geopolitical view inNDSStoreConfigurationand initializeNDSStorewith it.timeoutThe duration after which primary search results are ignored and the alternative search starts handling the query.
customPOIProvidersCustom data providers for injecting external POI data into the search engine.
customAPIURLThis is the custom base URL for online APIs. It defaults to nil, and “https://api.tomtom.com/search/2” will be the base URL. It can be used to change to another service that implements the same API.
Return Value
Returns an instance that implements
Searchwith hybrid search support and the geopolitical view set instore.
TomTom SDK for iOS (0.53.1)
HybridSearchFactory