Skip to content

Latest commit

 

History

History
299 lines (190 loc) · 15 KB

MapplsDirectionUI.md

File metadata and controls

299 lines (190 loc) · 15 KB

MapplsDirectionUI for iOS

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 apisupport@mappls.com.

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

To install the MapplsDirectionUI using CocoaPods:

Create a Podfile with the following specification:

pod 'MapplsDirectionUI', '1.0.8'

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:

Version Dated Description
1.0.8 27 Dec 2023 - Added dotted polyline for walking profile.
- Bug Fixes
1.0.7 11 Oct 2023 - Added support for dark, light and auto theme.
1.0.6 24 Aug 2023 - Bugs & Improvemtns.
1.0.5 02 Aug 2023 - Added a drivingMode selector view and improvements.
1.0.4 10 Jun 2023 Improvements and bug fixes.
1.0.3 03 May 2023 added a delegate to set route option and bug fixes.
1.0.2 17 Apr 2023 Imporvements and bug fixes.
1.0.1 22 June 2022 Added Objective c support. and Added directionListDefault button.
1.0.0 14 June 2022 Initial MapplsDirectionUI version.

It is required to set MAPPLS's keys to use any MAPPL's SDK. Please see here to achieve this.

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)
        
self.locationModels.append(source)
self.locationModels.append(viaPoint)
self.locationModels.append(destination)
let directionVC = MapplsDirectionViewController(for: self.locationModels, style: .auto)
directionVC.profileIdentifier = .driving
directionVC.attributationOptions = [.congestionLevel]
directionVC.resourceIdentifier = .routeETA
self.navigationController?.pushViewController(directionVC, animated: false)

Objective-c

MapplsDirectionViewController * directionVC = [[MapplsDirectionViewController alloc]init];
directionVC.delegate = self;
directionVC.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:directionVC animated:false completion:nil];

OR

MapplsDirectionLocation* source = [[MapplsDirectionLocation alloc] initWithLocation:@"78.00,28.00" displayName:@"haridwar" displayAddress:@"" locationType:0];
MapplsDirectionLocation* destination = [[MapplsDirectionLocation alloc] initWithLocation:@"1T182A" displayName:@"Majorganj" displayAddress:@"" locationType:1];

NSArray<MapplsDirectionLocation *>* locations = [[NSArray<MapplsDirectionLocation *> alloc] initWithObjects:current,destination, nil];

MapplsDirectionViewController * directionVC = [[MapplsDirectionViewController alloc]initFor:locations style:nil];

directionVC.delegate = self;
directionVC.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:directionVC animated:false completion:nil];

Here are the properties use to configure MapplsDirectionViewController route.

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

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.

shouldShowDrivingModeSelector is a property which is use to show the driving mode at the run time. Its default value is false

MapplsDirectionUIConfiguration.shared.shouldShowDrivingModeSelector = false

shouldShowRouteReportSummary is a property which is use to show route report summary on the route. its default value is false

MapplsDirectionUIConfiguration.shared.shouldShowRouteReportSummary = false

shouldShowTollCostEstimation is a property which is use to show route toll cost estimation button. its default value is false

MapplsDirectionUIConfiguration.shared.shouldShowTollCostEstimation = false

isShowCongestionDelayOnRoute is a property which is use to show congestion delay on the route. to show Congestion delay on map attributationOptions should must be set to [ .congestionLevel, .expectedTravelTime, .baseDuration]

MapplsDirectionUIConfiguration.shared.isShowCongestionDelayOnRoute = false

shouldAllowToAddViapoint is a property which for enable or disable user to add via point.

let directionVC = MapplsDirectionViewController()
directionVC.shouldAllowToAddViapoint = true

showDottedPolylineForWalkingProfile is boolean a propery to show dotted or plain polyline for walking profile. Its default value is true.


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

Swift

/// 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], viewController: UIViewController, locations: [MapplsDirectionLocation], selectedRouteIndex: Int, error: NSError)
// The meathod will be called when  user click on auto search result
5. didDirectionsAutocomplete(viewController: MapplsAutocompleteViewController, withPlace place: MapplsAtlasSuggestion, resultType type: MapplsAutosuggestResultType)
//  The meathod will be called when  user click on auto search favourite places
6. didDirectionsAutocomplete(viewController: MapplsAutocompleteViewController, withFavouritePlace place: MapplsUIWidgetAutosuggestFavouritePlace)

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.




Our many happy customers:


For any queries and support, please contact:

Email us at apisupport@mappls.com

Support Need support? contact us!



@ Copyright 2020 CE Info Systems Pvt. Ltd. All Rights Reserved.