Compiling Swift 2 code [closed]

It will not be possible to build Swift 2 code in Xcode 9. You have two options:

  1. Use the compatible version of Xcode (Xcode 7.x.x) and macOS (OS X El Capitan 10.11, or macOS Sierra 10.12) to build the app.

  2. Migrate the codebase to a more recent version of Swift (3.x or 4.x) using the migration assistant built into a recent version of Xcode. Xcode 8 can migrate your code from Swift 2 to Swift 3.

It will not be possible to build Swift 2 code with Xcode 4 as it does not support Swift 2 (doesn't have the compiler).