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

后端 未结 8 1006
灰色年华
灰色年华 2020-12-18 17:58

I have a VoiceSampler.framework that was built with Xcode 10.3

I am trying to use that framework in Xcode11 in a new project. I have successfully added that framewor

相关标签:
8条回答
  • 2020-12-18 18:27

    You need to set the Build Libraries for Distribution option to Yes in your framework's build settings, otherwise the swift compiler doesn't generate the necessary .swiftinterface files which are the key to future compilers being able to load your old library.

    This ends up in your project.pbxproj file as:

    BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
    

    After setting this flag, a framework I compiled using Xcode 11.0 (swift 5.1) was able to be compiled with Xcode 11.2 (swift 5.1.2) and everything appears to be working correctly.

    0 讨论(0)
  • 2020-12-18 18:30

    As I have already described here, the provider of VoiceSample should rebuild the framework with BUILD_LIBRARY_FOR_DISTRIBUTION = YES;. In such case, you will be able to use VoiceSample with all Swift versions.

    0 讨论(0)
提交回复
热议问题