vladasha
vladasha

Reputation: 403

Downgrade xcode project from swift 3 to swift 2.2

I downloaded the new xCode 8 beta. When i opened my old project(in swift 2.2), i clicked the convert to new swift syntax, and i clicked swift 3. The problem is that i use a framework downloaded with carthage (Kanna). I have tried to use the:

carthage update

but it doesn't work.

When i try to run the code on the new Xcode-beta, i get this error:

Module file was created by an older version of the compiler; rebuild 'Kanna' and try again:

Upvotes: 3

Views: 4765

Answers (3)

Parth Adroja
Parth Adroja

Reputation: 13524

Seems like i am very late to answer but there is update available for 'Kanna' framework supporting swift 3.0. You can add this to your podfile if you use CocoaPods

use_frameworks!
pod 'Kanna', '~> 2.0.0'

Or for Carthage you can install like

github "tid-kijyun/Kanna" ~> 2.0.0

Upvotes: 1

3squad
3squad

Reputation: 395

When you open your project with Xcode 8.0 for the first time, you will be prompted via the migration assistant to do a migration pass. The assistant can also be invoked manually from the menu

Edit -> Convert -> To Current Swift Syntax…

If you upgraded code e.g. 2.3 to 3.0 and now want downgrade to 2.3 you can use above. If any errors occur copy your code from last commit in your repository and it should work fine.

Upvotes: 1

Luca Angeletti
Luca Angeletti

Reputation: 59536

First of all save a backup of your current project. Now!

Solution 1

Open your project with Xcode 7.3.1, it uses Swift 2.2 so it will signal you a bunch of errors. Since you know Swift 2.2 you should be able to fix the errors and make you project again compatible with Swift 2.2

Solution 2

In Xcode 8 beta you can choose the Swift versione (Swift 2.3 or Swift 3.0). Select Swift 2.3 (it's fully compatible with Swift 2.3 but does support the new iOS API). Then, again, fix the errors manually.

Solution 3

Open the library you are using and use Xcode 8 to upgrade that to Swift 3.0. This is a temporary solution until the developer of that library will provide the upgraded code

Upvotes: 1

Related Questions