-
Notifications
You must be signed in to change notification settings - Fork 31
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
Swift 3 Update #41
Swift 3 Update #41
Conversation
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.
Thanks for this PR! Please upgrade to the latest CocoaPods prerelease and build and test this project on all four platforms (iOS, macOS, tvOS, and watchOS).
|
||
COCOAPODS: 1.1.0.rc.2 | ||
COCOAPODS: 1.0.1 |
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.
Please upgrade to CocoaPods 1.1.0.rc.2. That would obviate the SWIFT_VERSION
workaround above.
characterSet.removeCharactersInString("/)") | ||
return characterSet | ||
let allowedCharacterSet: CharacterSet = { | ||
let characterSet = (CharacterSet.urlPathAllowed as NSCharacterSet).mutableCopy() as! NSMutableCharacterSet |
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.
Now we can mark this variable as var
instead of copying and casting it. A var
CharacterSet allows us to call removeCharacters(in:)
, just like an NSMutableCharacterSet.
let escapedURL = URL.absoluteString!.stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacterSet)! | ||
open override var description: String { | ||
#if swift(>=3.0) | ||
let escapedURL = URL.absoluteString.addingPercentEncoding( withAllowedCharacters: .urlHostAllowed)! | ||
#else |
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.
Remove this Swift 2.2 case, since this PR forces client code to use Swift 3 at a minimum.
return nil | ||
} | ||
objectString = String(data: data, encoding: NSUTF8StringEncoding)! | ||
objectString = String(data: data, encoding: String.Encoding.utf8)! |
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.
Nit: drop String.Encoding
, which is implied.
@@ -169,7 +169,7 @@ public class SnapshotOptions: NSObject, SnapshotOptionsProtocol { | |||
|
|||
The default value of this property matches the natural scale factor associated with the main screen. However, only images with a scale factor of 1.0 or 2.0 are ever returned by the classic Static API, so a scale factor of 1.0 of less results in a 1× (standard-resolution) image, while a scale factor greater than 1.0 results in a 2× (high-resolution or Retina) image. | |||
*/ | |||
public var scale: CGFloat = UIScreen.mainScreen().scale | |||
open var scale: CGFloat = UIScreen.main.scale |
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.
Update the macOS and watchOS cases as well.
if let p = request.url?.pathComponents, | ||
let f = p.last, | ||
let s = f.components(separatedBy: ".").first?.components(separatedBy: "x") | ||
, s[0] == String(width) && s[1] == String(height) { |
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.
Nit: move the comma to the previous line.
where s == "2x" { | ||
let e = f.components(separatedBy: "@").last, | ||
let s = e.components(separatedBy: ".").first | ||
, s == "2x" { |
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.
Nit: move the comma to the previous line.
where p[3] == "pin-" + size + "-" + label + | ||
stub(condition: isHost(serviceHost)) { request in | ||
if let p = request.url?.pathComponents | ||
, p[3] == "pin-" + size + "-" + label + |
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.
Nit: move the comma to the previous line.
@@ -393,24 +393,25 @@ class MapboxStaticTests: XCTestCase { | |||
latitude: 45.52475063103141, longitude: -122.68209457397461 | |||
) | |||
]) | |||
// let path = Path(coordinates: []) |
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.
Remove commented out line.
where p[4] == "auto" { | ||
stub(condition: isHost(serviceHost)) { request in | ||
if let p = request.url?.pathComponents | ||
, p[4] == "auto" { |
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.
Nit: move comma to previous line.
Is there any progress for this PR? Can we help at all? |
Please look into this, I'd love to use it in my dissertation and finals project! |
Superseded by #50. |
No description provided.