This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import Mapbox | |
| import MapboxNavigation | |
| import MapboxCoreNavigation | |
| import MapboxDirections | |
| class ViewController: UIViewController { | |
| var mapView: MGLMapView! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Begin navigation when navigation button is tapped | |
| @objc func startNavigation(sender: UIButton) { | |
| let options = NavigationRouteOptions(coordinates: points) | |
| options.profileIdentifier = .automobile | |
| Directions.shared.calculate(options) { (waypoints, routes, error) in | |
| guard let route = routes?.first, error == nil else { | |
| print(error!.localizedDescription) | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Handle single taps | |
| @objc @IBAction func handleMapTap(sender: UITapGestureRecognizer) { | |
| let point = sender.location(in: sender.view!) | |
| let coordinate = mapView.convert(point, toCoordinateFrom: mapView) | |
| points.append(coordinate) | |
| let annotation = MGLPointAnnotation() | |
| annotation.coordinate = coordinate | |
| mapView.addAnnotation(annotation) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Setup single tap gesture | |
| let singleTap = UITapGestureRecognizer(target: self, action: #selector(handleMapTap(sender:))) | |
| for recognizer in mapView.gestureRecognizers! where recognizer is UITapGestureRecognizer { | |
| singleTap.require(toFail: recognizer) | |
| } | |
| mapView.addGestureRecognizer(singleTap) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // ExploreOutdoors | |
| // | |
| // Created by Steven Rockarts on 2018-09-01. | |
| // Copyright © 2018 Figure4Software. All rights reserved. | |
| // | |
| import UIKit | |
| import Mapbox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://github.com/CocoaPods/Specs.git' | |
| project 'ExploreOutdoors.xcodeproj' | |
| platform :ios, '11' | |
| workspace 'ExploreOutdoors' | |
| use_frameworks! | |
| target 'ExploreOutdoors' do | |
| pod 'Mapbox-iOS-SDK' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import Mapbox | |
| import MapboxNavigation | |
| import MapboxCoreNavigation | |
| import MapboxDirections | |
| class ViewController: UIViewController { | |
| var mapView: MGLMapView! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.