Is it possible to compile Latest Swift version on older Xcode?

走远了吗. 提交于 2019-11-30 05:21:06

I figured it out that Yes it is possible. You can achieve it by installing the latest Snapshot:

Development Snapshots are prebuilt binaries that are automatically created from mainline development branches.

https://swift.org/download/#snapshots

Snapshot is a toolchain that you can install into Xcode which contains the latest compiler, leading to let you able to build your app on the latest tools.


How to setup a snapshot into Xcode?

1- Download the latest snapshot (Xcode) from Swift website.

2- Install the downloaded snapshot .pkg file.

3- Run Xcode and then go to: Xcode -> Toolchains -> Manage toolchains.

4- After selecting "Components" - "Toolchains" options, you should see:

Select "Swift Developer Snapshot" and thats it! You might need to reset Xcode after doing the above steps.

Reminder: You should reselect "Xcode 8.3.3" option after done playing around Swift 4, as mentioned in Swift - Using Downloads section:

To submit to the App Store you must build your app using the version of Swift that comes included within Xcode.

If all you want to do is play around with Swift 4, you could also use the IBM Swift Sandbox which always has the most recent snapshot.

Although it is not directly from the Xcode, you could also use the Iswift which should has the latest swift version (latest snapshot).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!