MPIMapView

open class MPIMapView : WKWebView, WKNavigationDelegate, UIGestureRecognizerDelegate

This class contains methods that help to display and interact with a Mappedin venue

  • Undocumented

    Declaration

    Swift

    public var venueData: MPIData?
  • Undocumented

    Declaration

    Swift

    public var currentMap: MPIMap?
  • Undocumented

    Declaration

    Swift

    public var delegate: MPIMapViewDelegate?
  • Undocumented

    Declaration

    Swift

    public lazy var blueDotManager: MPIBlueDotManager { get set }
  • Undocumented

    Declaration

    Swift

    public init(frame: CGRect)
  • Undocumented

    Declaration

    Swift

    required public init?(coder aDecoder: NSCoder)
  • Loads the map based on the options passed in MPIMapView

    Declaration

    Swift

    open func loadVenue(options: MPIOptions.Init, showVenueOptions: MPIOptions.ShowVenue? = nil)

    Parameters

    options

    The options MPIOptions.Init to load the MPIMapView with

    Return Value

    void

  • Sets the map of the mapview to the MPIMap passed in

    Declaration

    Swift

    open func setMap(map: MPIMap, completionCallback: ((String?) -> Void)? = nil)

    Parameters

    map

    The MPIMap to set the MPIMapViewto

    completionCallback

    Callback when the MPIMapView has completed setting the map, contains an error string as the first parameter if it fails, defaults to null

    Return Value

    return void

  • Sets the map of the mapview to the MPIMap passed in

    Declaration

    Swift

    open func setMap(mapId: String, completionCallback: ((String?) -> Void)? = nil)

    Parameters

    mapId

    The id of MPIMap to set the MPIMapViewto

    completionCallback

    Callback when the MPIMapView has completed setting the map, contsains an error string as the first paerameter if it fails

    Return Value

    return void

  • Highlight polygons

    Declaration

    Swift

    open func setPolygonColor(polygon: MPIPolygon, color: String, textColor: String? = nil, opacity: Double = 1.0)
  • Sets the color of the MPIPolygon

    Declaration

    Swift

    open func setPolygonColor(polygonId: String, color: String, textColor: String? = nil, opacity: Double = 1.0)

    Parameters

    polygonId

    The id of the MPIPolygon to change the color

    color

    The color to set the MPIPolygon to, e.g ‘black’, ‘#CDCDCD’

    textColor

    The color to set the textColor of the legacyLabels, e.g ‘black’, ‘#CDCDCD’

    opacity

    The opacity of the MPIPolygon, e.g 0 to 1.0

    Return Value

    void

  • Clears all

    Declaration

    Swift

    open func clearAllPolygonColors(completionCallback: ((String?) -> Void)? = nil)

    Parameters

    completionCallback

    Callback for when the mapview is finished clearing all polygon colors, contains an error string as the first parameter if it failed, defaults to null

    Return Value

    void

  • BlueDot

    Declaration

    Swift

    open func enableBlueDot(options: MPIOptions.BlueDot? = nil)
  • Disables the blue dot so it does not appear on the mapview

    Declaration

    Swift

    open func disableBlueDot()

    Return Value

    void

  • Updates the position of the blue dot on the mapview

    Declaration

    Swift

    open func updatePosition(position: MPIPosition)

    Parameters

    position

    The MPIPosition of the blue dot

    Return Value

    void

  • Navigation

    Declaration

    Swift

    open func getDirections(to: MPINavigatable, from: MPINavigatable, accessible: Bool = true, directionsCallback: @escaping (MPIDirections) -> Void)
  • Draws a path on the MPIMapView

    Declaration

    Swift

    open func drawPath(path: [MPINode], pathOptions: MPIOptions.Path? = nil)

    Parameters

    path

    A list of MPINode that the path will be drawn from

    pathOptions

    Path options to customize how the path is drawn, defaults to null

    Return Value

    void

  • Remove all paths on the MPIMapView

    Declaration

    Swift

    open func removeAllPaths(completionCallback: ((String?) -> Void)? = nil)

    Parameters

    completionCallback

    Callback when the MPIMapView has completed removing all the paths, contains an error string as the first parameter if it fails, defaults to nil

    Return Value

    void

  • Draws a journey on the [MPIMapView]

    Declaration

    Swift

    open func drawJourney(directions: MPIDirections, options: MPIOptions.Journey? = nil)

    Parameters

    directions

    The directions for the journey

    options

    journey options, include setting a connectionTemplateString and pathOptions

    Return Value

    void

  • Remove all paths and connection tooltips on the [MPIMapView]

    Declaration

    Swift

    open func clearJourney()

    Return Value

    void

  • Camera

    Declaration

    Swift

    public func focusOn(focusOptions: MPIOptions.Focus)
  • Adds an interactive polygon (allows it to be clickable)

    Declaration

    Swift

    public func addInteractivePolygon(polygon: MPIPolygon)

    Parameters

    polygon

    The MPIPolygon to make interactive

    Return Value

    void

  • Adds an interactive polygon (allows it to be clickable)

    Declaration

    Swift

    public func addInteractivePolygon(polygonId: String)

    Parameters

    polygonId

    The id of the polygon to make interactive

    Return Value

    void

  • Removes all labels

    Declaration

    Swift

    open func removeAllLabels()

    Return Value

    void

  • Sets a label for the MPIPolygon

    Declaration

    Swift

    public func labelPolygon(polygon: MPIPolygon, options: MPIOptions.Label)

    Parameters

    polygon

    The MPIPolygon to set the label

    options

    Provides the options MPIOptions.Label to customize how the label is

    Return Value

    void

  • Sets a label for the MPIPolygon

    Declaration

    Swift

    public func labelPolygon(polygonId: String, options: MPIOptions.Label)

    Parameters

    polygonId

    The id of the MPIPolygon to set the label

    options

    Provides the options MPIOptions.Label to customize how the label is

    Return Value

    void

  • Gets the nearest node by screen coordinates

    Declaration

    Swift

    public func getNearestNodeByScreenCoordinates(x: Int, y: Int, map: MPIMap? = nil, nearestNodeCallback: @escaping (MPINode?) -> Void)

    Parameters

    x

    The x coordinate based off WebView dimensions

    y

    The y coordinate based off WebView dimensions

    map

    Optional map to find the nearest node on, defaults to the current map if null

    nearestNodeCallback

    Returns a node if it finds one

    Return Value

    void

  • Undocumented

    Declaration

    Swift

    public func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!)
  • Called when page has finished loading

    Declaration

    Swift

    public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!)
  • Called if page has failed to load

    Declaration

    Swift

    public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error)