Skip to content

Add NavigationView usage example. #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Navigation-Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
2B521D522409242A00984CF8 /* CustomBottomBannerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B521D512409242A00984CF8 /* CustomBottomBannerView.xib */; };
2B5470632816C74A0068DA3F /* Custom-RoutingProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B5470622816C74A0068DA3F /* Custom-RoutingProvider.swift */; };
6CD94175657B369FB9C6B8B5 /* Pods_DocsCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9107365E41DB56AF5F37BEE2 /* Pods_DocsCode.framework */; };
8A0A0171289882D800E4D8CA /* Navigation-View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0A0170289882D800E4D8CA /* Navigation-View.swift */; };
8A0B182326553482005107DE /* CustomSegue.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8A0B182226553482005107DE /* CustomSegue.storyboard */; };
8A2DFA57261650A60034A87E /* CustomCameraStateTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2DFA55261650A60034A87E /* CustomCameraStateTransition.swift */; };
8A2DFA58261650A60034A87E /* CustomViewportDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2DFA56261650A60034A87E /* CustomViewportDataSource.swift */; };
Expand Down Expand Up @@ -64,6 +65,7 @@
2B521D512409242A00984CF8 /* CustomBottomBannerView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CustomBottomBannerView.xib; sourceTree = "<group>"; };
2B5470622816C74A0068DA3F /* Custom-RoutingProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Custom-RoutingProvider.swift"; sourceTree = "<group>"; };
751C9DE4E717073D370EB4EF /* Pods-DocsCode.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DocsCode.release.xcconfig"; path = "Target Support Files/Pods-DocsCode/Pods-DocsCode.release.xcconfig"; sourceTree = "<group>"; };
8A0A0170289882D800E4D8CA /* Navigation-View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Navigation-View.swift"; sourceTree = "<group>"; };
8A0B182226553482005107DE /* CustomSegue.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CustomSegue.storyboard; sourceTree = "<group>"; };
8A2DFA55261650A60034A87E /* CustomCameraStateTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomCameraStateTransition.swift; sourceTree = "<group>"; };
8A2DFA56261650A60034A87E /* CustomViewportDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomViewportDataSource.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -212,7 +214,6 @@
E4F99A65CCB2B9CB623270EE /* Pods-Navigation-Examples.debug.xcconfig */,
0544DEF056F7B94F491CBD53 /* Pods-Navigation-Examples.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -278,6 +279,7 @@
11DC36F126161DAF0042CD4A /* Location-Snapping.swift */,
11B6E81626176F3600872E4D /* Upcoming-Intersection.swift */,
B4F805ED26791AD900D5F1C8 /* Custom-User-Location.swift */,
8A0A0170289882D800E4D8CA /* Navigation-View.swift */,
8AFBF217265E851700468551 /* CustomSegue */,
8A2DFA52261650600034A87E /* NavigationCamera */,
8AC9129E2494118400B6941E /* TestData */,
Expand Down Expand Up @@ -628,6 +630,7 @@
C5C0D63820589422003A3B1D /* Custom-Server.swift in Sources */,
C3893F1C25F96BDC0058A987 /* Custom-Waypoints.swift in Sources */,
8A31388726402DF400763714 /* Navigation-From-Segue.swift in Sources */,
8A0A0171289882D800E4D8CA /* Navigation-View.swift in Sources */,
B4F805EE26791AD900D5F1C8 /* Custom-User-Location.swift in Sources */,
C346744E263C57610068A65E /* Beta-Query-Parameters.swift in Sources */,
2B521D4E24090A3A00984CF8 /* CustomBarsViewController.swift in Sources */,
Expand Down
7 changes: 7 additions & 0 deletions Navigation-Examples/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,12 @@ let listOfExamples: [NamedController] = [
controller: CustomRoutingProviderViewController.self,
storyboard: nil,
pushExampleToViewController: true
),
(
name: "Navigation View",
description: "Demonstrates how to use NavigationView.",
controller: NavigationViewViewController.self,
storyboard: nil,
pushExampleToViewController: true
)
]
34 changes: 34 additions & 0 deletions Navigation-Examples/Examples/Navigation-View.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import UIKit
import MapboxCoreNavigation
import MapboxNavigation
import MapboxDirections

class NavigationViewViewController: UIViewController {

var navigationView: NavigationView!

override func viewDidLoad() {
super.viewDidLoad()

navigationView = NavigationView(frame: view.bounds)
navigationView.autoresizingMask = [.flexibleWidth, .flexibleHeight]

let navigationViewportDataSource = NavigationViewportDataSource(navigationView.navigationMapView.mapView,
viewportDataSourceType: .raw)
navigationView.navigationMapView.navigationCamera.viewportDataSource = navigationViewportDataSource
navigationView.navigationMapView.navigationCamera.follow()

view.addSubview(navigationView)

navigationView.bottomBannerContainerView.isHidden = false
navigationView.bottomBannerContainerView.heightAnchor.constraint(equalToConstant: 150.0).isActive = true
navigationView.bottomBannerContainerView.backgroundColor = .white
// TODO: Make public.
// navigationView.bottomBannerContainerView.isExpandable = true
// navigationView.bottomBannerContainerView.expansionOffset = 50.0

navigationView.topBannerContainerView.isHidden = false
navigationView.topBannerContainerView.heightAnchor.constraint(equalToConstant: 50.0).isActive = true
navigationView.topBannerContainerView.backgroundColor = .white
}
}
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ install! 'cocoapods', :warn_for_unused_master_specs_repo => false
platform :ios, '11.0'
use_frameworks!

pod 'MapboxCoreNavigation', '~> 2.6.0'
pod 'MapboxNavigation', '~> 2.6.0'
pod 'MapboxCoreNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :branch => 'main'
pod 'MapboxNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :branch => 'main'

target 'Navigation-Examples' do
end
Expand Down
62 changes: 38 additions & 24 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,66 +1,80 @@
PODS:
- MapboxCommon (22.0.0)
- MapboxCoreMaps (10.6.0):
- MapboxCommon (~> 22.0)
- MapboxCoreNavigation (2.6.0):
- MapboxCommon (22.1.0-rc.1)
- MapboxCoreMaps (10.7.0-rc.1):
- MapboxCommon (~> 22.1.0-rc)
- MapboxCoreNavigation (2.7.0-beta.3):
- MapboxDirections (~> 2.6)
- MapboxMobileEvents (~> 1.0)
- MapboxNavigationNative (~> 106.0)
- MapboxNavigationNative (~> 110.0)
- MapboxDirections (2.6.0):
- Polyline (~> 5.0)
- Turf (~> 2.4)
- MapboxMaps (10.6.0):
- MapboxCommon (= 22.0.0)
- MapboxCoreMaps (= 10.6.0)
- MapboxMaps (10.7.0-rc.1):
- MapboxCommon (= 22.1.0-rc.1)
- MapboxCoreMaps (= 10.7.0-rc.1)
- MapboxMobileEvents (= 1.0.8)
- Turf (~> 2.0)
- MapboxMobileEvents (1.0.8)
- MapboxNavigation (2.6.0):
- MapboxCoreNavigation (= 2.6.0)
- MapboxMaps (~> 10.6)
- MapboxNavigation (2.7.0-beta.3):
- MapboxCoreNavigation (= 2.7.0-beta.3)
- MapboxMaps (= 10.7.0-rc.1)
- MapboxMobileEvents (~> 1.0)
- MapboxSpeech (~> 2.0)
- Solar-dev (~> 3.0)
- MapboxNavigationNative (106.0.0):
- MapboxCommon (~> 22.0)
- MapboxNavigationNative (110.0.0):
- MapboxCommon (~> 22.1.0-rc.1)
- MapboxSpeech (2.0.1)
- Polyline (5.0.2)
- Solar-dev (3.0.1)
- Turf (2.4.0)

DEPENDENCIES:
- MapboxCoreNavigation (~> 2.6.0)
- MapboxNavigation (~> 2.6.0)
- MapboxCoreNavigation (from `https://github.com/mapbox/mapbox-navigation-ios.git`, branch `main`)
- MapboxNavigation (from `https://github.com/mapbox/mapbox-navigation-ios.git`, branch `main`)

SPEC REPOS:
trunk:
- MapboxCommon
- MapboxCoreMaps
- MapboxCoreNavigation
- MapboxDirections
- MapboxMaps
- MapboxMobileEvents
- MapboxNavigation
- MapboxNavigationNative
- MapboxSpeech
- Polyline
- Solar-dev
- Turf

EXTERNAL SOURCES:
MapboxCoreNavigation:
:branch: main
:git: https://github.com/mapbox/mapbox-navigation-ios.git
MapboxNavigation:
:branch: main
:git: https://github.com/mapbox/mapbox-navigation-ios.git

CHECKOUT OPTIONS:
MapboxCoreNavigation:
:commit: 7886707486121dcb458c12f51083531227a296c6
:git: https://github.com/mapbox/mapbox-navigation-ios.git
MapboxNavigation:
:commit: 7886707486121dcb458c12f51083531227a296c6
:git: https://github.com/mapbox/mapbox-navigation-ios.git

SPEC CHECKSUMS:
MapboxCommon: 8b10731406d2e4472d52ae6ec3679e6e5c4bd55e
MapboxCoreMaps: 2019935caed7e56be1417ff70d3ad0c0cbf0264e
MapboxCoreNavigation: b2c6fb963d434e04c2609967b1c573d30f6f6ee0
MapboxCommon: a4cf3c329d10c66d14d1b43d38af6dbd90a7d8f7
MapboxCoreMaps: 03bb0539ed3a8913b9eb01211d15de0574dbf642
MapboxCoreNavigation: 227f4abaea1e599c07d3185bf884a6e425343b16
MapboxDirections: 4a51348c02146bd246ce67c3e3d06e809003fbba
MapboxMaps: e078cc1343a0513174869a5e16ae9a18d3977252
MapboxMaps: c982c6ffebd7cbd5c9f69153dbcdadd5adf3f631
MapboxMobileEvents: febdd92835daa258ca1c1faad0821c0b3394ef40
MapboxNavigation: 8092769e6a1450be497cca0dc79cf188884f683c
MapboxNavigationNative: ea019c7a8e4c6a2776d9fe11963085095d17b14a
MapboxNavigation: 0043250d453488556091e4028d135d1adaf2609c
MapboxNavigationNative: dfcdc073de416677f6be529dddd184dd7157d46a
MapboxSpeech: fb9129e1ca7cc2dd465397d2aea1f5f510de260e
Polyline: fce41d72e1146c41c6d081f7656827226f643dff
Solar-dev: 4612dc9878b9fed2667d23b327f1d4e54e16e8d0
Turf: 60b93cfdc62758526bc7bf1ef191a829aeb9694d

PODFILE CHECKSUM: f1c747048a6fdea1d3e8814dacc4705ec7a2a180
PODFILE CHECKSUM: 83cd7c216a75a3629527137ecc695972e6c5b825

COCOAPODS: 1.11.3