问题
In early 2019 or late 2018 Apple will release Xcode 10.x with Swift 5. In my project I use a Cocoa pods which are written in Swift 3 and abandoned by the author.
I would like to know if I have to replace the pods or upgrade or maybe I can leave them as they are. If Swift 5 will build targets written in Swift 3, I can continue to use pods written in Swift 3 as they are, if not, I how to upgrade/change it.
Question: Does Swift 5 build targets that are written in either Swift 4 or Swift 3?
回答1:
It’s not clear yet how far they’ll go.
Source Stability
Similar to Swift 4 , the Swift 5 compiler will provide a source compatibility mode to allow source code written using some previous versions of Swift to compile with the Swift 5 compiler. The Swift 5 compiler will at least support code written in Swift 4, but may also extend back to supporting code written in Swift 3. The final decision on the latter will be made in early 2018.
Or they haven’t updated the Documentation yet..
Link from Hamish.
回答2:
No, you won't be able to mix Swift 3 and Swift 5 to release on an app store.
Swift 5 requires at least Xcode 10.2, and Xcode 10.2 dropped support for Swift 3, which means that it will refuse to build any Swift 3.x target.
Swift 5 no longer supports the Swift 3 Package.swift tools-version. Packages still on the Swift 3 Package.swift tools-version should update to a newer tools-version. (41974124)
Swift 3 mode has been removed. Supported values for the -swift-version flag are 4, 4.2, and 5. (43101816)
来源:https://stackoverflow.com/questions/52205276/can-i-use-swift-5-to-build-targets-that-are-written-in-swift-3