-
Notifications
You must be signed in to change notification settings - Fork 318
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
Changes from all commits
7e73731
23d6ede
6ecf2f7
d395bfc
33dbcc6
858d386
0a32a20
4e24ccf
d59b750
a5328a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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> | ||
} | ||
|
This file was deleted.
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") | ||
} | ||
} |
There was a problem hiding this comment.
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
Float
s orNSNumber
s.