Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Swift 2.3 in XCode 8 Playgrounds?

I have my playground project written in Swift 2.2 and I want take advantage of timeline visuals and try new debug features introduced in Xcode 8 beta. By default, Xcode 8 beta is using Swift 3 in Playgrounds and I cannot find a way to change that. Updating my code to Swift 3 is not an option unfortunately, because my code will be compiled on server with Swift 2.2 environment.

like image 286
Misha Svyatoshenko Avatar asked Jun 15 '16 22:06

Misha Svyatoshenko


People also ask

Can Swift Playgrounds learn Swift?

But then what? Swift Playgrounds teaches concepts and uses real Swift structure, but it's not real code. It doesn't make an app, it just guides Byte around and solves puzzles. Swift doesn't have a real command called collectGem() after all.

What is the difference between Swift playground and Xcode?

Xcode and Swift are both software development products developed by Apple. Swift is a programming language used to create apps for iOS, macOS, tvOS, and watchOS. Xcode is an Integrated Development Environment (IDE) that comes with a set of tools that helps you build Apple-related apps.

Can you use swift playground on Mac?

Swift Playgrounds is a revolutionary app for iPad and Mac that makes it fun to learn and experiment with Swift — a powerful programming language created by Apple and used by the pros to build today's most popular apps. Swift Playgrounds requires no coding knowledge, so it's perfect for students just starting out.

How do I run code in Xcode playground?

Simply click the Run button at the bottom-right of the playground, and wait for execution to complete. Xcode now compiles your code, and shows you its result. The default code doesn't output anything to the Console, but you should be able to see the value of the variable str in the sidebar on the right of Xcode.


1 Answers

Unfortunately, according to Apple it is impossible:

For instance, Playgrounds in Xcode only work with Swift 3, and notably the Swift Playgrounds app for iPad also uses Swift 3. Xcode project templates all use Swift 3, and all documentation is presented in a format appropriate for Swift 3.

More here.

like image 157
pommefrite Avatar answered Sep 28 '22 05:09

pommefrite