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.
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With