Skip to content

Commit 41c5c1b

Browse files
committed
Add NavigationViewViewController skeleton example.
1 parent 11f6ab9 commit 41c5c1b

File tree

5 files changed

+89
-24
lines changed

5 files changed

+89
-24
lines changed

Navigation-Examples.xcodeproj/project.pbxproj

+10-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
8A33629624E4844E0086C647 /* Building-Extrusion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A33629524E4844E0086C647 /* Building-Extrusion.swift */; };
2222
8A96379C2492B366008DEF2A /* Route-Deserialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A96379A2492B366008DEF2A /* Route-Deserialization.swift */; };
2323
8A96379D2492B366008DEF2A /* route.json in Resources */ = {isa = PBXBuildFile; fileRef = 8A96379B2492B366008DEF2A /* route.json */; };
24+
8AA038742804C1110007BD2D /* Navigation-View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA038732804C1110007BD2D /* Navigation-View.swift */; };
2425
8AC9129D2494106100B6941E /* Route-Initialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AC9129C2494106100B6941E /* Route-Initialization.swift */; };
2526
8AE033222628EDFF000E7145 /* Route-Lines-Styling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AE033212628EDFF000E7145 /* Route-Lines-Styling.swift */; };
2627
8DF510741FEB08F70049DB9C /* Embedded-Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DF510731FEB08F70049DB9C /* Embedded-Navigation.swift */; };
@@ -70,6 +71,7 @@
7071
8A33629524E4844E0086C647 /* Building-Extrusion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Building-Extrusion.swift"; sourceTree = "<group>"; };
7172
8A96379A2492B366008DEF2A /* Route-Deserialization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Route-Deserialization.swift"; sourceTree = "<group>"; };
7273
8A96379B2492B366008DEF2A /* route.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = route.json; sourceTree = "<group>"; };
74+
8AA038732804C1110007BD2D /* Navigation-View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Navigation-View.swift"; sourceTree = "<group>"; };
7375
8AC9129C2494106100B6941E /* Route-Initialization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Route-Initialization.swift"; sourceTree = "<group>"; };
7476
8AD2F2132489B5C800F81353 /* apply-mapbox-access-token.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "apply-mapbox-access-token.sh"; sourceTree = "<group>"; };
7577
8AE033212628EDFF000E7145 /* Route-Lines-Styling.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Route-Lines-Styling.swift"; sourceTree = "<group>"; };
@@ -263,6 +265,7 @@
263265
11DC36F126161DAF0042CD4A /* Location-Snapping.swift */,
264266
11B6E81626176F3600872E4D /* Upcoming-Intersection.swift */,
265267
B4F805ED26791AD900D5F1C8 /* Custom-User-Location.swift */,
268+
8AA038732804C1110007BD2D /* Navigation-View.swift */,
266269
8AFBF217265E851700468551 /* CustomSegue */,
267270
8A2DFA52261650600034A87E /* NavigationCamera */,
268271
8AC9129E2494118400B6941E /* TestData */,
@@ -279,7 +282,6 @@
279282
4EF74F60792B221A1A61A3CE /* Pods-Navigation-Examples.debug.xcconfig */,
280283
A8BC0BE26AF9683D3B034741 /* Pods-Navigation-Examples.release.xcconfig */,
281284
);
282-
name = Pods;
283285
path = Pods;
284286
sourceTree = "<group>";
285287
};
@@ -451,7 +453,8 @@
451453
inputPaths = (
452454
"${PODS_ROOT}/Target Support Files/Pods-Navigation-Examples/Pods-Navigation-Examples-frameworks.sh",
453455
"${BUILT_PRODUCTS_DIR}/MapboxCoreNavigation/MapboxCoreNavigation.framework",
454-
"${BUILT_PRODUCTS_DIR}/MapboxDirections/MapboxDirections.framework",
456+
"${BUILT_PRODUCTS_DIR}/MapboxDirections-pre/MapboxDirections.framework",
457+
"${BUILT_PRODUCTS_DIR}/MapboxGeocoder.swift/MapboxGeocoder.framework",
455458
"${BUILT_PRODUCTS_DIR}/MapboxMaps/MapboxMaps.framework",
456459
"${BUILT_PRODUCTS_DIR}/MapboxNavigation/MapboxNavigation.framework",
457460
"${BUILT_PRODUCTS_DIR}/MapboxSpeech/MapboxSpeech.framework",
@@ -467,6 +470,7 @@
467470
outputPaths = (
468471
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCoreNavigation.framework",
469472
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxDirections.framework",
473+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxGeocoder.framework",
470474
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMaps.framework",
471475
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxNavigation.framework",
472476
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxSpeech.framework",
@@ -565,7 +569,8 @@
565569
inputPaths = (
566570
"${PODS_ROOT}/Target Support Files/Pods-DocsCode/Pods-DocsCode-frameworks.sh",
567571
"${BUILT_PRODUCTS_DIR}/MapboxCoreNavigation/MapboxCoreNavigation.framework",
568-
"${BUILT_PRODUCTS_DIR}/MapboxDirections/MapboxDirections.framework",
572+
"${BUILT_PRODUCTS_DIR}/MapboxDirections-pre/MapboxDirections.framework",
573+
"${BUILT_PRODUCTS_DIR}/MapboxGeocoder.swift/MapboxGeocoder.framework",
569574
"${BUILT_PRODUCTS_DIR}/MapboxMaps/MapboxMaps.framework",
570575
"${BUILT_PRODUCTS_DIR}/MapboxNavigation/MapboxNavigation.framework",
571576
"${BUILT_PRODUCTS_DIR}/MapboxSpeech/MapboxSpeech.framework",
@@ -581,6 +586,7 @@
581586
outputPaths = (
582587
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxCoreNavigation.framework",
583588
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxDirections.framework",
589+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxGeocoder.framework",
584590
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxMaps.framework",
585591
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxNavigation.framework",
586592
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapboxSpeech.framework",
@@ -628,6 +634,7 @@
628634
2B521D502409240E00984CF8 /* CustomBottomBannerView.swift in Sources */,
629635
B480E428261E4C4600C16FA0 /* Route-Alerts.swift in Sources */,
630636
C58FB8771FE98B0E00C4B491 /* Waypoint-Arrival-Screen.swift in Sources */,
637+
8AA038742804C1110007BD2D /* Navigation-View.swift in Sources */,
631638
C35F1E4D2656967E00EC54CD /* Offline-Regions.swift in Sources */,
632639
C5F130A61FEB2D7800463E86 /* Advanced.swift in Sources */,
633640
C58FB86C1FE89CEC00C4B491 /* ExampleContainerViewController.swift in Sources */,

Navigation-Examples/Constants.swift

+7
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,12 @@ let listOfExamples: [NamedController] = [
174174
controller: OfflineRegionsViewController.self,
175175
storyboard: nil,
176176
pushExampleToViewController: true
177+
),
178+
(
179+
name: "Navigation View",
180+
description: "Demonstrates how to use NavigationView.",
181+
controller: NavigationViewViewController.self,
182+
storyboard: nil,
183+
pushExampleToViewController: true
177184
)
178185
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import UIKit
2+
import MapboxCoreNavigation
3+
import MapboxNavigation
4+
import MapboxDirections
5+
6+
class NavigationViewViewController: UIViewController {
7+
8+
var navigationView: NavigationView!
9+
10+
override func viewDidLoad() {
11+
super.viewDidLoad()
12+
13+
navigationView = NavigationView(frame: view.bounds)
14+
navigationView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
15+
16+
let navigationViewportDataSource = NavigationViewportDataSource(navigationView.navigationMapView.mapView,
17+
viewportDataSourceType: .raw)
18+
navigationView.navigationMapView.navigationCamera.viewportDataSource = navigationViewportDataSource
19+
navigationView.navigationMapView.navigationCamera.follow()
20+
21+
view.addSubview(navigationView)
22+
23+
navigationView.bottomBannerContainerView.isHidden = false
24+
navigationView.bottomBannerContainerView.heightAnchor.constraint(equalToConstant: 150.0).isActive = true
25+
navigationView.bottomBannerContainerView.backgroundColor = .white
26+
navigationView.isBottomBannerContainerViewExpandable = true
27+
navigationView.bottomBannerContainerViewOffset = 50.0
28+
29+
navigationView.topBannerContainerView.isHidden = false
30+
navigationView.topBannerContainerView.heightAnchor.constraint(equalToConstant: 50.0).isActive = true
31+
navigationView.topBannerContainerView.backgroundColor = .white
32+
}
33+
}

Podfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ install! 'cocoapods', :warn_for_unused_master_specs_repo => false
33
platform :ios, '11.0'
44
use_frameworks!
55

6-
pod 'MapboxCoreNavigation', '~> 2.0'
7-
pod 'MapboxNavigation', '~> 2.0'
6+
pod 'MapboxCoreNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :branch => 'maxim/1622-make-navigation-view-publicly-usable'
7+
pod 'MapboxNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :branch => 'maxim/1622-make-navigation-view-publicly-usable'
88

99
target 'Navigation-Examples' do
1010
end

Podfile.lock

+37-19
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,83 @@ PODS:
22
- MapboxCommon (21.2.0)
33
- MapboxCoreMaps (10.4.2):
44
- MapboxCommon (~> 21.2)
5-
- MapboxCoreNavigation (2.3.1):
6-
- MapboxDirections (~> 2.3)
5+
- MapboxCoreNavigation (2.4.0-rc.1):
6+
- MapboxDirections-pre (= 2.4.0-rc.1)
77
- MapboxMobileEvents (~> 1.0)
8-
- MapboxNavigationNative (~> 88.0)
9-
- MapboxDirections (2.3.0):
8+
- MapboxNavigationNative (~> 94.0)
9+
- MapboxDirections-pre (2.4.0-rc.1):
1010
- Polyline (~> 5.0)
1111
- Turf (~> 2.0)
12+
- MapboxGeocoder.swift (0.14.0)
1213
- MapboxMaps (10.4.2):
1314
- MapboxCommon (= 21.2.0)
1415
- MapboxCoreMaps (= 10.4.2)
1516
- MapboxMobileEvents (= 1.0.7)
1617
- Turf (~> 2.0)
1718
- MapboxMobileEvents (1.0.7)
18-
- MapboxNavigation (2.3.1):
19-
- MapboxCoreNavigation (= 2.3.1)
20-
- MapboxMaps (~> 10.3)
19+
- MapboxNavigation (2.4.0-rc.1):
20+
- MapboxCoreNavigation (= 2.4.0-rc.1)
21+
- MapboxGeocoder.swift (~> 0.14)
22+
- MapboxMaps (< 11.0.0, >= 10.4.1)
2123
- MapboxMobileEvents (~> 1.0)
2224
- MapboxSpeech (~> 2.0)
2325
- Solar-dev (~> 3.0)
24-
- MapboxNavigationNative (88.0.0):
25-
- MapboxCommon (~> 21.1)
26+
- MapboxNavigationNative (94.0.0):
27+
- MapboxCommon (~> 21.2)
2628
- MapboxSpeech (2.0.0)
2729
- Polyline (5.0.2)
2830
- Solar-dev (3.0.1)
2931
- Turf (2.3.0)
3032

3133
DEPENDENCIES:
32-
- MapboxCoreNavigation (~> 2.0)
33-
- MapboxNavigation (~> 2.0)
34+
- MapboxCoreNavigation (from `https://github.com/mapbox/mapbox-navigation-ios.git`, branch `maxim/1622-make-navigation-view-publicly-usable`)
35+
- MapboxNavigation (from `https://github.com/mapbox/mapbox-navigation-ios.git`, branch `maxim/1622-make-navigation-view-publicly-usable`)
3436

3537
SPEC REPOS:
3638
trunk:
3739
- MapboxCommon
3840
- MapboxCoreMaps
39-
- MapboxCoreNavigation
40-
- MapboxDirections
41+
- MapboxDirections-pre
42+
- MapboxGeocoder.swift
4143
- MapboxMaps
4244
- MapboxMobileEvents
43-
- MapboxNavigation
4445
- MapboxNavigationNative
4546
- MapboxSpeech
4647
- Polyline
4748
- Solar-dev
4849
- Turf
4950

51+
EXTERNAL SOURCES:
52+
MapboxCoreNavigation:
53+
:branch: maxim/1622-make-navigation-view-publicly-usable
54+
:git: https://github.com/mapbox/mapbox-navigation-ios.git
55+
MapboxNavigation:
56+
:branch: maxim/1622-make-navigation-view-publicly-usable
57+
:git: https://github.com/mapbox/mapbox-navigation-ios.git
58+
59+
CHECKOUT OPTIONS:
60+
MapboxCoreNavigation:
61+
:commit: c9a22dd86c6e79ab6b1e069b24fa60d1f099926f
62+
:git: https://github.com/mapbox/mapbox-navigation-ios.git
63+
MapboxNavigation:
64+
:commit: c9a22dd86c6e79ab6b1e069b24fa60d1f099926f
65+
:git: https://github.com/mapbox/mapbox-navigation-ios.git
66+
5067
SPEC CHECKSUMS:
5168
MapboxCommon: eb826fdc45e8b77f87aca2519986d992fd4881b7
5269
MapboxCoreMaps: 227b33943eb5b257fdebc56474007e214981f43d
53-
MapboxCoreNavigation: 3ca55ca21aa8e19e1ea755d26b1047596e2791da
54-
MapboxDirections: 305d743dbee1e0b49d6100a2b946b47cec18b42c
70+
MapboxCoreNavigation: 7c4becf21080038075037c79fb3134b8dd2726e6
71+
MapboxDirections-pre: 8d80dba7d137332c0ca757f54afda55d9eb782d9
72+
MapboxGeocoder.swift: a288e92ec13fbd65bbdfd7c54c61b0e80d19e734
5573
MapboxMaps: 7a613c740ceb4179e839727494e192371b237546
5674
MapboxMobileEvents: f7f3e8daeb4b83688ae62a4172dce79169a97233
57-
MapboxNavigation: ce6fca5051bbc3f20025c883af160845534c939c
58-
MapboxNavigationNative: 7c588083547b121cf154402560364059aa5271e9
75+
MapboxNavigation: 7bcb989524df5d481f4656020ba3266d1fb560bf
76+
MapboxNavigationNative: 74b6bbc4d48ffef7e10217bb2e7f2fc452984f8d
5977
MapboxSpeech: e4ed02984444b6373374c72c369edaf045cc490c
6078
Polyline: fce41d72e1146c41c6d081f7656827226f643dff
6179
Solar-dev: 4612dc9878b9fed2667d23b327f1d4e54e16e8d0
6280
Turf: d8d52444483c968cf2d65b8b54640f8faf4dda03
6381

64-
PODFILE CHECKSUM: ade747cd70b06f12dd4076e55177eb029b4813b0
82+
PODFILE CHECKSUM: 6c00ac7a36a0aba3136251462f071edc0a309ac4
6583

6684
COCOAPODS: 1.11.3

0 commit comments

Comments
 (0)