Skip to main content

Direction UI


MapplsDirectionUI SDK provides the UI components to quickly integrate Route API from MapplsAPIKit framework in iOS application. It offers the following basic functionalities:

  1. Takes support of Mappls's Place search for searching locations of origin, destinations and via points.
  2. It allows to use origin and destinations in Mappls's digital address (semicolon separated) Mappls Pin or WGS 84 geographical coordinates both.
  3. The ability to set the vehicle profile like driving, and biking.
  4. Easily set the resource for traffic and ETA information.

For details, please contact


This plugin can be installed using CocoaPods. It is available with name MapplsDirectionUI.

Using CocoaPods‚Äč

To install the MapplsDirectionUI using CocoaPods:

Create a Podfile with the following specification:

pod 'MapplsDirectionUI', '0.0.3'

Run pod repo update && pod install and open the resulting Xcode workspace.


This library depends upon several Mappls's own and third party libraries. All dependent libraries will be automatically installed using CocoaPods.

Below are list of dependcies which are required to run this SDK:



It is required to set MAPPLS's keys to use any MAPPL's SDK. Please refer the documentation here.


The MapplsDirectionUI makes it easy to integrate Route from MapplsAPIKit SDK to your iOS application. It gives you all the tools you need to add Directions related UI components to your application.


MapplsDirectionsViewController is type of UIViewController which you can use to show screen for getting input from user to choose origin and destination and show routes after that.

let directionVC = MapplsDirectionViewController(for: [MapplsDirectionLocation]())
self.navigationController?.pushViewController(directionVC, animated: false)

As from above code you can see it requires an array of object type MapplsDirectionLocation. It can be an blank array to launch screen without any chosen locations.

Also you can pass fixed locations and launch instnace of MapplsDirectionViewController, as shown in below code:

var locationModels = [MapplsDirectionLocation]()
let source = MapplsDirectionLocation(location: "77.2639,28.5354", displayName: "Govindpuri", displayAddress: "", locationType: .suggestion)

let viaPoint = MapplsDirectionLocation(location: "12269L", displayName: "Sitamarhi", displayAddress: "", locationType: .suggestion)

let destination = MapplsDirectionLocation(location: "1T182A", displayName: "Majorganj", displayAddress: "", locationType: .suggestion)

let directionVC = MapplsDirectionViewController(for: self.locationModels)
directionVC.profileIdentifier = .driving
directionVC.attributationOptions = [.congestionLevel]
directionVC.resourceIdentifier = .routeETA
self.navigationController?.pushViewController(directionVC, animated: false)


Here are the properties use to configure MapplsDirectionViewController route.

Profile Identifier‚Äč

It is instance of enum DirectionsProfileIdentifier which can accepts values driving, walking, biking, trucking. By default its value is driving.

Resource Identifier‚Äč

It is instance of enum DirectionsResourceIdentifier which can accepts values routeAdv, routeETA. By default its value is routeAdv.

Note: To use RouteETA ‚ÄėresourceIdentifier‚Äô should be routeETA and ‚ÄėprofileIdentifier‚Äô should be driving. In response of RouteETA a unique identifier to that request will be received which can be get using parameter routeIdentifier of object Route.


AttributeOptions for the route. Any combination of AttributeOptions can be specified. By default, no attribute options are specified.


A Boolean value indicating whether alternative routes should be included in the response. The default value of this property is true.


MapplsAutocompleteViewController provides an interface that displays a table of autocomplete predictions that updates as the user enters text. Place selections made by the user are returned to the app via the MapplsAutocompleteViewControllerResultsDelegate.


AutocompleteAttributionSetting allow to change the appearance of the logo in MapplsAutocompleteViewController


This property represents a set of restrictions that may be applied to autocomplete requests. This allows customization of autocomplete suggestions to only those places that are of interest.


A routeShapeResolution indicates the level of detail in a route’s shape, or whether the shape is present at all its default value is .full


A Boolean value indicating whether MapplsRouteStep objects should be included in the response. its default value is true.


To show the Start Navigation button if the origin is current location.

MapplsDirectionViewController is created using several UI components whose appearance can be changed according to user requirements. Some of them are listed as below:

  • MapplsDirectionTopBannerView
  • MapplsDirectionBottomBannerView


It is a protocol class which will be used for callback methods as shown below:

Call Back Handler‚Äč

/// This meathod will be called when back button is clicked in `TopBannerView`
1. didRequestForGoBack(for view: MapplsDirectionTopBannerView)

/// The meathod will be called when  add viapoint button will clicked in `TopBannerView`.
2. didRequestForAddViapoint(_ sender: UIButton,for isEditMode: Bool)

/// The meathod will be called when  Directions button will clicked in `BottomBannerView`.
3. didRequestDirections()

//The meathod will be called when  start button will clicked in `BottomBannerView`.
4. didRequestForStartNavigation(for routes: [Route], locations: [MapplsDirectionLocation], selectedRouteIndex: Int, error: NSError)


MapplsDirectionTopBannerView is type of UIView which show the source, destination and viapoint locations at the top of MapplsDirectionViewController

This class accepts array of MapplsDirectionLocation from which it set value of source, destination and viapoint.


MapplsDirectionBottomBannerView is class of type UIView, it used for showing the route information i.e ArivalTime, DistanceRemening, TimeRemening.

To use this class it takes we need to call a function updateBottomBanner which accepts three parameters i.e route, selectedRoute, locationModel.

  • route: It is an array of the Routes which is required to update bottom banner view.
  • selectedRoute: If you have multiple routes then it will give the selected route in Integer
  • locationModel: LocationModel is an array of the type MapplsDirectionLocation which is required to manage bottom banner view.