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

Moya on Swift 2.3 & 3.0. #513

Closed
2 of 7 tasks
aaroncrespo opened this issue Jun 18, 2016 · 16 comments
Closed
2 of 7 tasks

Moya on Swift 2.3 & 3.0. #513

aaroncrespo opened this issue Jun 18, 2016 · 16 comments

Comments

@aaroncrespo
Copy link
Contributor

aaroncrespo commented Jun 18, 2016

Took a crack at checking out swift 2.3 support this morning...

The good news:

  • Apple's migrator tool is great, after running on Moya, the demo target and tests (iOS,tvOS) built and worked/passed
  • The changes don't look too bad from Moya's end
  • Foundation Value types and the new Swift API Guidelines don't come into play until Swift 3 which greatly limits changes.
  • swift 2 and 2.3 can live side by side with #if swift(>=2.3) ...

The meh news:

  • Nimble under macOS had some issues I've seen reported as Xcode/Foundation related -- affects macOS test target
  • xcodebuild doesn't pick up the swift legacy flag which triggers a compile against a 2.0 toolchain Xcode should in the future hopefully not do this. Until then rake build and rake test don't work without setting the TOOLCHAINS Environment flag. This is probably a bug in xcodebuild.
  • Relatedly Setting of the legacy swift flag is not performed by the migrator maybe because they want 2.0/2.3/3.0 to try and live side by side but that will cause weirdness with dependent projects.

So tracking what happened when I got it all building:

  • Moya Changes:
  • A couple URL API's changed nullability. Should check documentation and expectations and see if implicitly unwrapped is safe. Most are similar to:
 public func url(route: TargetType) -> String {
-    return route.baseURL.URLByAppendingPathComponent(route.path).absoluteString
+    return route.baseURL.URLByAppendingPathComponent(route.path)!.absoluteString!
 }

P.S. It's been a while since I ran Moya in dev mode and it took me a little while to get oriented, do you guys think a quick Getting Started With Developing Moya section somewhere would be useful? maybe #270. I don't really use rake for build scripting so it took a bit to get that setup.

@brentleyjones
Copy link

RxSwift: ??

With ReactiveX/RxSwift@9b1583f RxSwift supports Swift 2.3. It doesn't have the correct build flag.

@ashfurrow
Copy link
Member

This is great work and a nice comprehensive write-up, thanks @aaroncrespo!

@aaroncrespo
Copy link
Contributor Author

Another thing to think about is if it makes sense to skip 2.3 and go straight to 3.0 or how to support 3 versions. The #if swift() tests don't work so well when swift 3.0 is in the mix.

@lowell lowell closed this as completed Jun 22, 2016
@lowell lowell reopened this Jun 22, 2016
@lowell
Copy link
Member

lowell commented Jun 22, 2016

Sorry about the accidental closure. Misunderstood what 'Close' meant in a third-party GitHub client. Was just trying to close the issue view. 😳

@ashfurrow
Copy link
Member

No problem, it happens!

@brentleyjones
Copy link

I highly recommend a Swift 2.3 build, even as a version bump, before going to Swift 3. Alamofire had breaking changes so without this people won't be able to use pre-Swift 3 on Xcode 8. I know I'll be using Xcode 8 and Swift 2.3 for a while after the release.

@sunshinejr sunshinejr changed the title Moya on swift 2.3 Moya on Swift 2.3 & 3.0. Jul 1, 2016
@sunshinejr
Copy link
Member

I've changed the title due to #522 discussion.

@orta
Copy link
Member

orta commented Jul 2, 2016

Aye, think it's worth shipping a 2.3 dupe of current Moya, one the Rx deps have them, then moving to 3.0

@ashfurrow
Copy link
Member

That makes sense – should we make 2.3 version off of master or the most recent commit? (master has breaking changes.)

@orta
Copy link
Member

orta commented Jul 2, 2016

Maybe the last stable release?

@aaroncrespo
Copy link
Contributor Author

Looks like Alamofire is about to cut a 3.5.0 release which will have both swift 2.2 and swift 2.3 support. Then Moya.spec can point to that.

https://github.com/Alamofire/Alamofire/milestone/27

I think this is the dependency to push a release supporting 2.3

@tdouglas1313
Copy link

Is there any update on swift 3.0 support now that Xcode 8 GM is out

@tommy60703
Copy link

Need swift 2.3 and swift 3.0 support here...

@sunshinejr
Copy link
Member

sunshinejr commented Sep 8, 2016

We will have to wait before updating to the GM Seed version:

Edit: I've opened #608 for Swift 3.0 support.

@BasThomas
Copy link
Contributor

@sunshinejr It seems Result already is Swift 3. :)

@AndrewSB
Copy link
Member

AndrewSB commented Nov 8, 2016

This looks like it's been solved with the 8.0.0 beta releases, I'm going to close it out. Please feel free to open this if there are any loose ends!

@AndrewSB AndrewSB closed this as completed Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants