Mixing SWIF 2.3 and SWIFT in same project

Hi, I can't find any information in document about this. Basically I have a main app target written in SWIF 2.3 and I have a new extension that I want it be written in SWIFT 3. but i am getting following error while tryining compile app with this configuration. My question is " is it possible to mix two different swift version of code in same bundle?"

"The following binaries use incompatible versions of Swift"

Replies

Use of Swift 3 tools typicall expect migration from 2.x.

Hi Henry,


First, all code has to be in the same swift version. That being said, one way you could solve the problem is by sticking to Swift 2.3 and then setting your Extension Target's Use Legacy Swift Language Version to "Yes".


You can find that option while Xcode 8 is open as follows:


  1. Select your (container) app project root in the Project Navigator (on the left-hand side)
  2. On the right-hand side, select your extension under the TARGETS section
  3. Once the extension is selected, click on the Build Settings tab
  4. Scroll down and find Use Legacy Swift Language Version and set it to Yes
  5. You can now build the project