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

Swift4.2 support #264

Closed
usk2000 opened this issue Oct 1, 2018 · 6 comments
Closed

Swift4.2 support #264

usk2000 opened this issue Oct 1, 2018 · 6 comments

Comments

@usk2000
Copy link

usk2000 commented Oct 1, 2018

Hi, there.

RunLoopMode is remated to RunLoop.Mode at Swift4.2

In MultipartFormDataBodyParameters.swift:
I think these functions

    override func schedule(in aRunLoop: RunLoop, forMode mode: RunLoopMode) {

    }

    override func remove(from aRunLoop: RunLoop, forMode mode: RunLoopMode) {

    }

should be

    #if swift(>=4.2)
    override func schedule(in aRunLoop: RunLoop, forMode mode: RunLoop.Mode) {

    }

    override func remove(from aRunLoop: RunLoop, forMode mode: RunLoop.Mode) {

    }
   #else 
    override func schedule(in aRunLoop: RunLoop, forMode mode: RunLoopMode) {

    }

    override func remove(from aRunLoop: RunLoop, forMode mode: RunLoopMode) {

    }
   #endif

Thanks

@ikesyo
Copy link
Collaborator

ikesyo commented Oct 1, 2018

APIKit is Swift 4 compatible, so should be compiled on Swift 4.2 compiler with Swift 4.0 language mode (compatibility mode). What are you suffering from?

If you are using CocoaPods, you can use post_install hook to pin Swift version to 4.0 for APIKit: CocoaPods/CocoaPods#6791 (comment).

On the other hand, we could add s.swift_version = '4.0' to APIKit.podspec for the pinning purpose. FYI @ishkawa

@usk2000
Copy link
Author

usk2000 commented Oct 1, 2018

@ikesyo
I want to use Swift4.2 feature in my project,
When I converted code to Swift 4.2, I get build error with APIKit.

APIKit is Swift 4 compatible, so should be compiled on Swift 4.2 compiler with Swift 4.0 language mode (compatibility mode)

OK, I will try it.

@ikesyo
Copy link
Collaborator

ikesyo commented Oct 1, 2018

@usk2000 Because Swift 4 or later can use multiple language versions simultaneously per target basis, even if you use Swift 4.2 for your application target, there is no need to update APIKit to Swift 4.2 as well.

@ikesyo
Copy link
Collaborator

ikesyo commented Oct 1, 2018

If you are using CocoaPods, you can use post_install hook to pin Swift version to 4.0 for APIKit: CocoaPods/CocoaPods#6791 (comment).

On the other hand, we could add s.swift_version = '4.0' to APIKit.podspec for the pinning purpose. FYI @ishkawa

Oh the podspec is already specifying swift_version so there should be no problem for CocoaPods users 😅:

s.swift_version = "4.0"

@usk2000
Copy link
Author

usk2000 commented Oct 1, 2018

@ikesyo

Because Swift 4 or later can use multiple language versions simultaneously per target basis

I will try it. I seems to set this feature wrong.

Thanks.

@usk2000
Copy link
Author

usk2000 commented Oct 3, 2018

@ikesyo

Because Swift 4 or later can use multiple language versions simultaneously per target basis

I tried to re-install all Pods and I can build fine. It seems that I updated compiler version for APIKit.
Thanks for your advice!
And thanks for #265

@usk2000 usk2000 closed this as completed Dec 20, 2018
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

No branches or pull requests

2 participants