SearchTileStore

public class SearchTileStore

Simple wrapper for MapboxCommon.TileStore. This instance provides basicTileStore` functionality for a rare case when someone using Offline search without other Mapbox frameworks.

Use commonTileStore property to access underlaying MapboxCommon.TileStore

  • Default API Url used for Search tile data domain.

    Declaration

    Swift

    public let defaultEndPoint: String
  • Underlaying TileStore from MapboxCommon framework for use across Mapbox frameworks.

    Declaration

    Swift

    public private(set) var commonTileStore: MapboxCommon.TileStore { get }
  • Creates with shared MapboxCommon.TileStore instance at the default location. Creates a new MapboxCommon.TileStore if one doesn’t yet exist.

    Declaration

    Swift

    public init(accessToken: String)

    Parameters

    accessToken

    Mapbox access token

  • Creates with shared MapboxCommon.TileStore instance at the default location. Creates a new MapboxCommon.TileStore if one doesn’t yet exist. Throws AccessTokenNotFound if no access token found.

    Declaration

    Swift

    public convenience init() throws
  • Creates with custom CommonTileStore.

    Declaration

    Swift

    public init(commonTileStore: MapboxCommon.TileStore, accessToken: String)

    Parameters

    commonTileStore

    SearchEngine will start using provided TileStore

    accessToken

    Mapbox access token

  • Creates with custom CommonTileStore.

    Declaration

    Swift

    public convenience init(commonTileStore: MapboxCommon.TileStore) throws

    Parameters

    commonTileStore

    SearchEngine will start using provided TileStore Throws AccessTokenNotFound if no access token found.

  • Creates with shared MapboxCommon.TileStore instance for the given storage path. Creates a new MapboxCommon.TileStore if one doesn’t yet exist. If the given path is empty, the tile store at the default location is returned.

    Declaration

    Swift

    public init(accessToken: String, path: String)

    Parameters

    accessToken

    Mapbox access token

    path

    The path on disk where tiles and metadata will be stored.

  • Loads a new tile region or updates the existing one.

    Declaration

    Swift

    public func loadTileRegion(id: String, options: MapboxCommon.TileRegionLoadOptions)

    Parameters

    id

    The tile region identifier.

    options

    The tile region load options.

  • Loads a new tile region or updates the existing one.

    Declaration

    Swift

    public func loadTileRegion(
        id: String,
        options: MapboxCommon.TileRegionLoadOptions,
        progress: MapboxCommon.TileRegionLoadProgressCallback? = nil,
        completion: ((Result<MapboxCommon.TileRegion, TileRegionError>) -> Void)?
    )
    -> SearchCancelable

    Parameters

    id

    The tile region identifier.

    options

    The tile region load options.

    progress

    Invoked multiple times to report progress of the loading operation. Optional, default is nil.

    completion

    Invoked only once upon success, failure, or cancelation of the loading operation. Any Result error could be of type TileRegionError.

    Return Value

    A Cancelable object to cancel the load request

  • Removes a tile region.

    Removes a tile region from the existing packages list. The actual resources eviction might be deferred. All pending loading operations for the tile region with the given id will fail with Canceled error.

    Declaration

    Swift

    public func removeTileRegion(id: String)

    Parameters

    id

    The tile region identifier.

  • Removes a tile region.

    Removes a tile region from the existing packages list. The actual resources eviction might be deferred. All pending loading operations for the tile region with the given id will fail with Canceled error.

    Declaration

    Swift

    public func removeTileRegion(
        id: String,
        completion: ((Result<MapboxCommon.TileRegion, TileRegionError>) -> Void)?
    )

    Parameters

    id

    The tile region identifier.

    completion

    Completion with Result, error could be of type TileRegionError.