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

Swift 3 Update #41

Closed
wants to merge 2 commits into from
Closed

Swift 3 Update #41

wants to merge 2 commits into from

Conversation

andrewwells
Copy link

No description provided.

@1ec5 1ec5 mentioned this pull request Sep 30, 2016
3 tasks
Copy link
Contributor

@1ec5 1ec5 left a 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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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)!
Copy link
Contributor

@1ec5 1ec5 Sep 30, 2016

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
Copy link
Contributor

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) {
Copy link
Contributor

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" {
Copy link
Contributor

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 +
Copy link
Contributor

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: [])
Copy link
Contributor

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" {
Copy link
Contributor

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.

@dewski
Copy link

dewski commented Dec 5, 2016

Is there any progress for this PR? Can we help at all?

@kacper1703
Copy link

Please look into this, I'd love to use it in my dissertation and finals project!

@1ec5 1ec5 mentioned this pull request Feb 20, 2017
@1ec5
Copy link
Contributor

1ec5 commented Feb 20, 2017

Superseded by #50.

@1ec5 1ec5 closed this Feb 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants