Skip to content
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

Update to Maps SDK for iOS v4.0.0 #1076

Merged
merged 10 commits into from
Apr 24, 2018
Merged
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
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## master

* `NavigationViewControllerDelegate.navigationViewControllerDidCancelNavigation(_:)` has been superseded by `NavigationViewControllerDelegate.navigationViewControllerDidEndNavigation(_:cancelled:)`. [#1318]
(https://github.com/mapbox/mapbox-navigation-ios/pull/1318)
* Upgraded to the [Mapbox Maps SDK for iOS v4.0.0](https://github.com/mapbox/mapbox-gl-native/releases/tag/ios-v4.0.0). If you have customized the route map’s appearance, you may need to migrate your code to use expressions instead of style functions. ([#1076](https://github.com/mapbox/mapbox-navigation-ios/pull/1076))
* `NavigationViewControllerDelegate.navigationViewControllerDidCancelNavigation(_:)` has been superseded by `NavigationViewControllerDelegate.navigationViewControllerDidEndNavigation(_:cancelled:)`. [#1318](https://github.com/mapbox/mapbox-navigation-ios/pull/1318)
* `RouteController`’s `routeProgress` is now exposed to Objective-C. [#1323](https://github.com/mapbox/mapbox-navigation-ios/pull/1323)
* Exit indications are now drawn accurately with a correct exit bearing. [#1288](https://github.com/mapbox/mapbox-navigation-ios/pull/1288)
* Added a delegate method, `NavigationViewControllerDelegate.navigationViewController(_:roadNameAt:)` which allows you to customize the contents of the road name label displayed towards the bottom of the map view. [#1309](https://github.com/mapbox/mapbox-navigation-ios/pull/1309)
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> 3.7
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> 4.0
github "mapbox/MapboxDirections.swift" ~> 0.20.0
github "mapbox/turf-swift" ~> 0.1
github "mapbox/mapbox-events-ios" ~> 0.4
Expand Down
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "3.7.6"
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "4.0.0"
github "ceeK/Solar" "2.1.0"
github "mapbox/MapboxDirections.swift" "v0.20.0"
github "mapbox/mapbox-events-ios" "v0.4.0"
Expand Down
8 changes: 4 additions & 4 deletions Examples/Swift/CustomViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ class CustomViewController: UIViewController, MGLMapViewDelegate, AVSpeechSynthe
let line = MGLLineStyleLayer(identifier: layerIdentifier, source: lineSource)

// Style the line
line.lineColor = MGLStyleValue(rawValue: UIColor(red:0.00, green:0.45, blue:0.74, alpha:0.9))
line.lineWidth = MGLStyleValue(rawValue: 5)
line.lineCap = MGLStyleValue(rawValue: NSValue(mglLineCap: .round))
line.lineJoin = MGLStyleValue(rawValue: NSValue(mglLineJoin: .round))
line.lineColor = NSExpression(forConstantValue: UIColor(red:0.00, green:0.45, blue:0.74, alpha:0.9))
line.lineWidth = NSExpression(forConstantValue: 5)
line.lineCap = NSExpression(forConstantValue: "round")
line.lineJoin = NSExpression(forConstantValue: "round")

// Add source and layer
style.addSource(lineSource)
Expand Down
2 changes: 1 addition & 1 deletion MapboxNavigation-Documentation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Pod::Spec.new do |s|
s.module_name = "MapboxNavigation"

s.dependency "MapboxDirections.swift", "~> 0.19.1"
s.dependency "Mapbox-iOS-SDK", "~> 3.6"
s.dependency "Mapbox-iOS-SDK", "~> 4.0"
s.dependency "MapboxMobileEvents", "~> 0.4"
s.dependency "Solar", "~> 2.1"
s.dependency "Turf", "~> 0.1"
Expand Down
2 changes: 1 addition & 1 deletion MapboxNavigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Pod::Spec.new do |s|
s.module_name = "MapboxNavigation"

s.dependency "MapboxCoreNavigation", "#{s.version.to_s}"
s.dependency "Mapbox-iOS-SDK", "~> 3.6"
s.dependency "Mapbox-iOS-SDK", "~> 4.0"
s.dependency "Solar", "~> 2.1"
s.dependency "MapboxSpeech", "~> 0.0.1"

Expand Down
22 changes: 11 additions & 11 deletions MapboxNavigation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
C57607B11F4CC9E800C27423 /* Solar.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C57607B01F4CC97D00C27423 /* Solar.framework */; };
C57607B21F4CC9E800C27423 /* Solar.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C57607B01F4CC97D00C27423 /* Solar.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C578DA081EFD0FFF0052079F /* ProcessInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = C578DA071EFD0FFF0052079F /* ProcessInfo.swift */; };
C58159011EA6D02700FC6C3D /* MGLVectorSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C58159001EA6D02700FC6C3D /* MGLVectorSource.swift */; };
C58159011EA6D02700FC6C3D /* MGLVectorTileSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C58159001EA6D02700FC6C3D /* MGLVectorTileSource.swift */; };
C582BA2C2073E77E00647DAA /* StringTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C582BA2B2073E77E00647DAA /* StringTests.swift */; };
C582FD5F203626E900A9086E /* CLLocationDirection.swift in Sources */ = {isa = PBXBuildFile; fileRef = C582FD5E203626E900A9086E /* CLLocationDirection.swift */; };
C58822001FB0F0D7008B0A2D /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = C58821FF1FB0F0D7008B0A2D /* Error.swift */; };
Expand Down Expand Up @@ -598,7 +598,7 @@
C57491DE1FACC42F006F97BC /* CGPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CGPoint.swift; path = ../MapboxNavigation/CGPoint.swift; sourceTree = "<group>"; };
C57607B01F4CC97D00C27423 /* Solar.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Solar.framework; path = Carthage/Build/iOS/Solar.framework; sourceTree = "<group>"; };
C578DA071EFD0FFF0052079F /* ProcessInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProcessInfo.swift; sourceTree = "<group>"; };
C58159001EA6D02700FC6C3D /* MGLVectorSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MGLVectorSource.swift; sourceTree = "<group>"; };
C58159001EA6D02700FC6C3D /* MGLVectorTileSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MGLVectorTileSource.swift; sourceTree = "<group>"; };
C582BA2B2073E77E00647DAA /* StringTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringTests.swift; sourceTree = "<group>"; };
C582FD5E203626E900A9086E /* CLLocationDirection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLLocationDirection.swift; sourceTree = "<group>"; };
C58821FF1FB0F0D7008B0A2D /* Error.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1065,24 +1065,24 @@
isa = PBXGroup;
children = (
351BEC081E5BCC72006FE110 /* Bundle.swift */,
8D24A2F720409A890098CBF8 /* CGSize.swift */,
8D24A2F920449B430098CBF8 /* Dictionary.swift */,
8D24A2F52040960C0098CBF8 /* UIEdgeInsets.swift */,
8DF399B11FB257B30034904C /* UIGestureRecognizer.swift */,
351BEC041E5BCC6C006FE110 /* ManeuverDirection.swift */,
351BEBDF1E5BCC63006FE110 /* MGLMapView.swift */,
35D825F91E6A2DBE0088F83B /* MGLMapView+MGLNavigationAdditions.h */,
35D825FA1E6A2DBE0088F83B /* MGLMapView+MGLNavigationAdditions.m */,
C58159001EA6D02700FC6C3D /* MGLVectorSource.swift */,
C58159001EA6D02700FC6C3D /* MGLVectorTileSource.swift */,
8D5DFFF0207C04840093765A /* NSAttributedString.swift */,
351BEBF01E5BCC63006FE110 /* UIView.swift */,
8D24A2F720409A890098CBF8 /* CGSize.swift */,
8DB45E8F201698EB001EA6A3 /* UIStackView.swift */,
35CF34B01F0A733200C2692E /* UIFont.swift */,
35B7837D1F9547B300291F9A /* Transitioning.swift */,
359D283B1F9DC14F00FDE9C9 /* UICollectionView.swift */,
8DF399B11FB257B30034904C /* UIGestureRecognizer.swift */,
8D24A2F52040960C0098CBF8 /* UIEdgeInsets.swift */,
35CF34B01F0A733200C2692E /* UIFont.swift */,
8DB45E8F201698EB001EA6A3 /* UIStackView.swift */,
351BEBF01E5BCC63006FE110 /* UIView.swift */,
3512C7C71FB0A0C100CDD2A3 /* UIViewController.swift */,
8D391CE11FD71E78006BB91F /* Waypoint.swift */,
C5A7EC5B1FD610A80008B9BA /* VisualInstructionComponent.swift */,
8D391CE11FD71E78006BB91F /* Waypoint.swift */,
);
name = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -1798,7 +1798,7 @@
DADAD82F20350849002E25CA /* MBRouteVoiceController.m in Sources */,
C57491DF1FACC42F006F97BC /* CGPoint.swift in Sources */,
8D53136B20653FA20044891E /* ExitView.swift in Sources */,
C58159011EA6D02700FC6C3D /* MGLVectorSource.swift in Sources */,
C58159011EA6D02700FC6C3D /* MGLVectorTileSource.swift in Sources */,
351BEC011E5BCC63006FE110 /* ManeuverView.swift in Sources */,
35B1E2951F1FF8EC00A13D32 /* UserCourseView.swift in Sources */,
35B5A47E1FFFDCE5000A3C8D /* NavigationViewLayout.swift in Sources */,
Expand Down
12 changes: 6 additions & 6 deletions MapboxNavigation/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ typealias CongestionSegment = ([CLLocationCoordinate2D], CongestionLevel)

You may use this constant in your implementation of `NavigationMapViewDelegate.navigationMapView(_:routeStyleLayerWithIdentifier:source:)` if you want to keep the default line widths but customize other aspects of the route line.
*/
public let MBRouteLineWidthByZoomLevel: [Int: MGLStyleValue<NSNumber>] = [
10: MGLStyleValue(rawValue: 8),
13: MGLStyleValue(rawValue: 9),
16: MGLStyleValue(rawValue: 11),
19: MGLStyleValue(rawValue: 22),
22: MGLStyleValue(rawValue: 28)
public let MBRouteLineWidthByZoomLevel: [Int: NSExpression] = [
10: NSExpression(forConstantValue: 8),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure these don’t need to be NSExpressions; they can be bare Floats or NSNumbers.

13: NSExpression(forConstantValue: 9),
16: NSExpression(forConstantValue: 11),
19: NSExpression(forConstantValue: 22),
22: NSExpression(forConstantValue: 28)
]

/**
Expand Down
12 changes: 6 additions & 6 deletions MapboxNavigation/Dictionary.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import Foundation

extension Dictionary where Key == Int, Value: MGLStyleValue<NSNumber> {
extension Dictionary where Key == Int, Value: NSExpression {
/**
Returns a copy of the stop dictionary with each value multiplied by the given factor.
*/
public func multiplied(by factor: Double) -> Dictionary {
var newCameraStop: [Int: MGLStyleValue<NSNumber>] = [:]
for stop in self as [Int : MGLStyleValue<NSNumber>] {
let f = stop.value as! MGLConstantStyleValue
let newValue = f.rawValue.doubleValue * factor
newCameraStop[stop.key] = MGLStyleValue<NSNumber>(rawValue: NSNumber(value:newValue))
var newCameraStop: [Int: NSExpression] = [:]
for stop in self {
let currentValue = stop.value.constantValue as! Double
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this will crash if the dictionary contains any expression that isn’t a constant value. Since this is a public extension on Dictionary, we have to assume the developer is going to try to use it wherever the compiler lets them.

I continue to believe we should make this method private or remove it outright. A few explicit multiplications won’t greatly inconvenience the developer.

let newValue = currentValue * factor
newCameraStop[stop.key] = NSExpression(forConstantValue: newValue)
}
return newCameraStop as! Dictionary<Key, Value>
}
Expand Down
25 changes: 0 additions & 25 deletions MapboxNavigation/MGLVectorSource.swift

This file was deleted.

11 changes: 11 additions & 0 deletions MapboxNavigation/MGLVectorTileSource.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation
import Mapbox

extension MGLVectorTileSource {
var isMapboxStreets: Bool {
guard let configurationURL = configurationURL else {
return false
}
return configurationURL.scheme == "mapbox" && configurationURL.host!.components(separatedBy: ",").contains("mapbox.mapbox-streets-v7")
}
}
Loading