From d8fad34d1bcdb5038370191dcb6a25e491fa7499 Mon Sep 17 00:00:00 2001 From: Maxim Makhun Date: Mon, 11 Apr 2022 14:51:34 -0700 Subject: [PATCH 1/2] Add `NavigationViewViewController` skeleton example. --- Navigation-Examples/Constants.swift | 7 ++++ .../Examples/Navigation-View.swift | 33 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Navigation-Examples/Examples/Navigation-View.swift diff --git a/Navigation-Examples/Constants.swift b/Navigation-Examples/Constants.swift index 0468d30f..3b671b8e 100644 --- a/Navigation-Examples/Constants.swift +++ b/Navigation-Examples/Constants.swift @@ -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 ) ] diff --git a/Navigation-Examples/Examples/Navigation-View.swift b/Navigation-Examples/Examples/Navigation-View.swift new file mode 100644 index 00000000..845e8ff5 --- /dev/null +++ b/Navigation-Examples/Examples/Navigation-View.swift @@ -0,0 +1,33 @@ +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 + navigationView.isBottomBannerContainerViewExpandable = true + navigationView.bottomBannerContainerViewOffset = 50.0 + + navigationView.topBannerContainerView.isHidden = false + navigationView.topBannerContainerView.heightAnchor.constraint(equalToConstant: 50.0).isActive = true + navigationView.topBannerContainerView.backgroundColor = .white + } +} From 3d9b39047ae671bf1c90252bd0cb9a1da74ea090 Mon Sep 17 00:00:00 2001 From: Maxim Makhun Date: Mon, 1 Aug 2022 14:58:52 -0700 Subject: [PATCH 2/2] Update. --- Navigation-Examples.xcodeproj/project.pbxproj | 5 +- .../Examples/Navigation-View.swift | 7 ++- Podfile | 4 +- Podfile.lock | 62 ++++++++++++------- 4 files changed, 48 insertions(+), 30 deletions(-) diff --git a/Navigation-Examples.xcodeproj/project.pbxproj b/Navigation-Examples.xcodeproj/project.pbxproj index eb716e05..72ce5a72 100644 --- a/Navigation-Examples.xcodeproj/project.pbxproj +++ b/Navigation-Examples.xcodeproj/project.pbxproj @@ -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 */; }; @@ -64,6 +65,7 @@ 2B521D512409242A00984CF8 /* CustomBottomBannerView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CustomBottomBannerView.xib; sourceTree = ""; }; 2B5470622816C74A0068DA3F /* Custom-RoutingProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Custom-RoutingProvider.swift"; sourceTree = ""; }; 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 = ""; }; + 8A0A0170289882D800E4D8CA /* Navigation-View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Navigation-View.swift"; sourceTree = ""; }; 8A0B182226553482005107DE /* CustomSegue.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CustomSegue.storyboard; sourceTree = ""; }; 8A2DFA55261650A60034A87E /* CustomCameraStateTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomCameraStateTransition.swift; sourceTree = ""; }; 8A2DFA56261650A60034A87E /* CustomViewportDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomViewportDataSource.swift; sourceTree = ""; }; @@ -212,7 +214,6 @@ E4F99A65CCB2B9CB623270EE /* Pods-Navigation-Examples.debug.xcconfig */, 0544DEF056F7B94F491CBD53 /* Pods-Navigation-Examples.release.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -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 */, @@ -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 */, diff --git a/Navigation-Examples/Examples/Navigation-View.swift b/Navigation-Examples/Examples/Navigation-View.swift index 845e8ff5..1ee80791 100644 --- a/Navigation-Examples/Examples/Navigation-View.swift +++ b/Navigation-Examples/Examples/Navigation-View.swift @@ -9,7 +9,7 @@ class NavigationViewViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - + navigationView = NavigationView(frame: view.bounds) navigationView.autoresizingMask = [.flexibleWidth, .flexibleHeight] @@ -23,8 +23,9 @@ class NavigationViewViewController: UIViewController { navigationView.bottomBannerContainerView.isHidden = false navigationView.bottomBannerContainerView.heightAnchor.constraint(equalToConstant: 150.0).isActive = true navigationView.bottomBannerContainerView.backgroundColor = .white - navigationView.isBottomBannerContainerViewExpandable = true - navigationView.bottomBannerContainerViewOffset = 50.0 + // 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 diff --git a/Podfile b/Podfile index 07103a80..6dadcdd4 100644 --- a/Podfile +++ b/Podfile @@ -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 diff --git a/Podfile.lock b/Podfile.lock index 7844a597..57f692f2 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -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