1
votes

Module compiled with Swift 5.1 cannot be imported by the Swift 5.0 compiler

I need to compile my sdk in swift 5.1 such that it should work in project build using swift 5

2

2 Answers

1
votes

What I understand is module stability just included in Swift 5.1. Seem like Swift 5 still cannot use the framework that compiled with Swift 5.1 since module stability is not supported yet.

For your case, need to use compiled framework for specific Swfit version. i.e. If you gonna use for Swift 5 project, export your SDK with Swift 5 compiled. Same goes to Swift 5.1 project.

Swift 5.1, Module stability implemented https://swift.org/blog/swift-5-1-released/

Swift 5.0, Module stability still under development https://swift.org/blog/abi-stability-and-more/

0
votes

it does not make sense to compile a project created using Swift 5.1 with 5.0. Swift 5.0 cannot know how to compile something that is in the future (5.1).

Therefore the answer is simply that you cannot do that, it does not make sense to do so.