[GH-ISSUE #239] Swift 2.3 support #135

Closed
opened 2026-03-03 16:45:58 +03:00 by kerem · 5 comments
Owner

Originally created by @mz2 on GitHub (Jun 18, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/239

There are a few API changes in Swift 2.3 (or rather, in nullability annotations of Foundation) which make OAuthSwift not compile cleanly with Swift 2.3.

I've run the syntax migration tool for my fork over here: https://github.com/mpapp/OAuthSwift – this is simplistic though as it (probably?) breaks Swift 2.2 and earlier given the nullability changes.

Originally created by @mz2 on GitHub (Jun 18, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/239 There are a few API changes in Swift 2.3 (or rather, in nullability annotations of Foundation) which make OAuthSwift not compile cleanly with Swift 2.3. I've run the syntax migration tool for my fork over here: https://github.com/mpapp/OAuthSwift – this is simplistic though as it (probably?) breaks Swift 2.2 and earlier given the nullability changes.
kerem 2026-03-03 16:45:58 +03:00
Author
Owner

@phimage commented on GitHub (Jul 7, 2016):

I see your change on absoluteString(now optional), thx

Swift 2.3 is available as part of Xcode 8, not yet officially released, so I can modify the master branch
I can just create a new branch from the latest stable release and commit the change

<!-- gh-comment-id:230988745 --> @phimage commented on GitHub (Jul 7, 2016): I see your change on `absoluteString`(now optional), thx Swift 2.3 is available as part of Xcode 8, not yet officially released, so I can modify the master branch I can just create a new branch from the latest stable release and commit the change
Author
Owner

@mz2 commented on GitHub (Jul 7, 2016):

There's a preprocessor statement available for that as of Swift 2.2, which would let you support both:

#if swift(>=2.3)
…
<!-- gh-comment-id:231026131 --> @mz2 commented on GitHub (Jul 7, 2016): There's a preprocessor statement available for that as of Swift 2.2, which would let you support both: ``` #if swift(>=2.3) … ```
Author
Owner

@phimage commented on GitHub (Jul 7, 2016):

Ok the solution could be to add into NSURL+OAuthSwift.swift

var unsafeAbsoluteString: String {
     #if swift(>=2.3)
     return self.absoluteString!
     #else
    return self.absoluteString
    #endif
}

and use into code unsafeAbsoluteString instead of absoluteString

I could not test yet, I can't install xcode 8 with my current OS version and migrate is a little tricky for me
PR are welcomed

<!-- gh-comment-id:231144236 --> @phimage commented on GitHub (Jul 7, 2016): Ok the solution could be to add into NSURL+OAuthSwift.swift ``` swift var unsafeAbsoluteString: String { #if swift(>=2.3) return self.absoluteString! #else return self.absoluteString #endif } ``` and use into code `unsafeAbsoluteString` instead of `absoluteString` I could not test yet, I can't install xcode 8 with my current OS version and migrate is a little tricky for me PR are welcomed
Author
Owner

@phimage commented on GitHub (Jul 8, 2016):

os updated, xcode beta launched, and fix for 2.3 commited

<!-- gh-comment-id:231307577 --> @phimage commented on GitHub (Jul 8, 2016): os updated, xcode beta launched, and fix for 2.3 commited
Author
Owner

@mz2 commented on GitHub (Jul 8, 2016):

Sweet, thanks!

<!-- gh-comment-id:231493572 --> @mz2 commented on GitHub (Jul 8, 2016): Sweet, thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#135
No description provided.