Configure the Woosmap MultiSearch iOS SDK

Explore available parameters and understand how to combine the different autocomplete services on iOS

  1. API options
  2. Configuring a Provider
  3. Woosmap Address Provider
  4. Woosmap Localities Provider
  5. Woosmap Store Provider
  6. Google Places Provider

API options

For each API configuration you can apply the same optional parameters as defined in the dedicated REST API’s documentation.

Documentation:

Configuring a Provider

A provider is a wrapper around a Woosmap API or a Google API which will be called to return the result for a query or get details of a place. Each provider must be created from a provider configuration and this provider must then be passed to MultiSearch object by calling MultiSearch.addProvider method.

To tell the MultiSearch which autocomplete service you would like to implement, create new provider configuration object.

swift
        ProviderConfig(searchType: SearchProviderType, key: String, fallbackBreakpoint: Double? = nil, minInputLength: Int? = nil, param: ConfigParam? = nil) 

    

Required Parameters

Optional Parameters

ConfigParam class.

This class helps to collect all query parameter required for api calls to fine tune results Example for Localities creating ConfigParam with components, types, tags, language:

swift
        ConfigParam(components: Components? = nil, types: [String]? = nil, language: String? = nil, query: String? = nil, data: DataFormat? = nil, extended: String? = nil  ) 

    

Woosmap Address Provider

To create a configuration for Woosmap Address provider use the search type parameter SearchProviderType.address:

swift
        let addressProvider = ProviderConfig(searchType: .address, 
                                            key: woosmapPrivateKey)

    

Available Provider parameters

Example Woosmap Address Provider

swift
        let addressProvider = ProviderConfig(searchType: .address,
                                     key: woosmapPrivateKey,
                                     fallbackBreakpoint: 0.8,
                                     minInputLength: 1,
                                     param: ConfigParam(
                                                 components: Components(country: ["FR"]),
                                                 language: "fr"))

    

Woosmap Localities Provider

To create a configuration for Woosmap Localities provider use the search type parameter SearchProviderType.localities:

swift
        let localitiesProvider = ProviderConfig(searchType: .localities,
                                                key: woosmapPrivateKey)

    

Available Provider parameters

Example Woosmap Localities Provider

swift
        let localitiesProvider = ProviderConfig(searchType: .localities,
                                        key: woosmapPrivateKey,
                                        minInputLength: 1,
                                        param: ConfigParam(
                                            components: Components(country: ["FR"]),
                                            types: ["locality", "country", "postal_code"]))

    

Woosmap Store Provider

To create a configuration for Woosmap Store provider use the search type parameter SearchProviderType.store:

swift
        let storeProvider = ProviderConfig(searchType: .store,
                                          key: woosmapPrivateKey)

    

Available Provider parameters

Example Woosmap Store Provider

swift
        let storeProvider = ProviderConfig(searchType: .store,
                                   key: woosmapPrivateKey,
                                   ignoreFallbackBreakpoint: true,
                                   param: ConfigParam(query:"type:bose_store"))

    

Google Places Provider

To create a configuration for Google Places provider use the search type parameter SearchProviderType.places:

swift
        let placesProvider = ProviderConfig(searchType: .places,
                                           key: googleApiKey)

    

Available Provider parameters

Example Google Places Provider

swift
            let placesProvider = ProviderConfig(searchType: .places,
                                        key: googleApiKey,
                                        fallbackBreakpoint: 0.7,
                                        minInputLength: 1,
                                        param: ConfigParam(
                                            components: Components(country: ["FR"]), 
                                                                  language: "it"))

    
Was this article helpful?
Have more questions? Submit a request