29

We have big enough project which is built up with Swift 2.x and now Apple has just released Swift 4 so to move forward for latest version of Swift which path we can choose...

Do we need to migrate our code to Swift 3 first? Or we can directly migrate our code to Swift 4 using Xcode 9?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
RayofHope
  • 1,187
  • 2
  • 14
  • 30
  • where you able to successfully update the codebase to swift 4? i have stuck in the process where my new company has a legacy app built in 2.3..please share your idea on this – ashif-ismail Apr 17 '18 at 15:09
  • Please convert 2.3 codebase to support it to Swift 3.x first and then you should convert it to Swift 4.x – RayofHope Apr 27 '18 at 13:01

3 Answers3

34

Yes, you must migrate your code in Swift 3 compatible version. Xcode 9 allows conversion/migration from swift 3.0 only.

enter image description here


Swift 3.2 is supported by Xcode 9 & Xcode 8 both.

enter image description here



Convert your source code from Swift 2.0 to 3.2 using Xcode 8 and then continue with Xcode 9 (Swift 3.2 or 4).

For easier migration of your code, follow these steps: (it will help you to covert into latest version of swift supported by your Xcode Tool)

(Xcode) Menus: Edit ► Covert ► To Current Swift Syntax

enter image description here

Krunal
  • 77,632
  • 48
  • 245
  • 261
8

Yes, you first need to migrate your code from Swift 2 to Swift 3, using Xcode 8.

Xcode 8 is the last version to support Swift 2.

Starting with Xcode 9, the supported Swift versions are 3.2 and 4

enter image description here

RayofHope
  • 1,187
  • 2
  • 14
  • 30
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
3

Yes, you need old versions of Xcode . Old version are available here https://developer.apple.com/download/more/

Laky
  • 171
  • 1
  • 9