Skip to content

Commit

Permalink
Add DayStyle and NightStyle example
Browse files Browse the repository at this point in the history
  • Loading branch information
frederoni committed Jan 9, 2018
1 parent abb4a8d commit f99ffcb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Examples/Swift/ViewController.swift
Expand Up @@ -100,6 +100,12 @@ class ViewController: UIViewController, MGLMapViewDelegate, CLLocationManagerDel
alertController.addAction(UIAlertAction(title: "Default UI", style: .default, handler: { (action) in
self.startBasicNavigation()
}))
alertController.addAction(UIAlertAction(title: "DayStyle UI", style: .default, handler: { (action) in
self.startNavigation(styles: [DayStyle()])
}))
alertController.addAction(UIAlertAction(title: "NightStyle UI", style: .default, handler: { (action) in
self.startNavigation(styles: [NightStyle()])
}))
alertController.addAction(UIAlertAction(title: "Custom UI", style: .default, handler: { (action) in
self.startCustomNavigation()
}))
Expand Down Expand Up @@ -221,6 +227,17 @@ class ViewController: UIViewController, MGLMapViewDelegate, CLLocationManagerDel

present(navigationViewController, animated: true, completion: nil)
}

func startNavigation(styles: [Style]) {
guard let route = currentRoute else { return }

exampleMode = .default

let navigationViewController = NavigationViewController(for: route, styles: styles, locationManager: navigationLocationManager())
navigationViewController.delegate = self

present(navigationViewController, animated: true, completion: nil)
}

// MARK: Custom Navigation UI

Expand Down

0 comments on commit f99ffcb

Please sign in to comment.