Sweeper Sweeper - 2 months ago 8
iOS Question

How can I use swift 2 and swift 3 at the same time?

Although swift 3 is released, I don't want to update my code just yet, because a lot of the CocoaPods I used are still in swift 2. I don't know what the migrator will do to those pods. Will they remain unchanged, causing the project to not build successfully? Or will they be migrated to Swift 3 as well? I don't know!

On the other hand, I really want to try out the new syntax and other new features in Swift 3. They seem really cool!

How can I continue developing my existing projects with Swift 2, but for other projects, compile with Swift 3?

In other words, how can I choose a compiler for a project?

Answer

How can I continue developing my existing projects with Swift 2, but for other projects, compile with Swift 3?

Install both Xcode 7 (which has Swift 2) and Xcode 8 (for Swift 3) and use the xcode-select command line tool to switch between them.

Comments