News

Swift Playgrounds Teaches iOS Coding with iPad App

Along with releasing iOS 10 and Swift 3.0, Apple this week introduced Swift Playgrounds, a free iPad app that teaches how to use the company's young programming language to build apps for its flagship mobile operating system.

Apple said the Playgrounds app features engaging lessons, puzzles and challenges to teach students and beginners the basics of Swift and iOS coding in fun ways. The open source Swift language just yesterday hit version 3.0, after an extensive development effort aided by community developers.

By using an Apple mobile device to write apps for Apple mobile devices with Swift Playgrounds, Swift developers targeting iOS can take advantage of an interactive environment specifically designed for touch input. Thus coders can just tap and drag text or numbers in the left-hand pane of the app and immediately see the new results in the right-hand display pane.

Playgrounds were first introduced in Apple's Xcode IDE as a way to quickly experiment with code snippets, and they were featured in Apple's recent developer conference. Now, with the iPad app, they're put to use to teach the entire gamut of basic concepts including commands, functions, parameters, loops, conditional statements, variables, operators, types, initialization, bug fixing and other nuts-and-bolts functionality.

Swift Playgrounds
[Click on image for larger view.] Swift Playgrounds (source: Apple)

Along with teaching the basics, Swift Playgrounds provide developers with access to thousands of APIs in the iOS SDK and iOS frameworks including UIKit, SpriteKit, SceneKit, Bluetooth and Metal.

Unique coding features of Swift Playgrounds highlighted by Apple include:

  • QuickType for code. The Shortcut Bar intelligently presents the most likely next commands or values based on context, making it easy to write entire lines of code without touching a keyboard.
  • Touch to edit. Developers can tap to edit a number in-place with a pop-over keypad, or touch a color value to display a color picker. Coders can restructure code by simply dragging a brace to wrap around the surrounding code.
  • Library of snippets. Common code snippets such as loops, structures and switch statements can be dragged out of a library to create new code with much less typing.
  • Coding keyboard. Devs can quickly type numbers and symbols commonly used in Swift coding by simply dragging a finger across a key to select one of the alternate symbols.

The app comes with built-in lessons and templates, and pre-built or newly created playgrounds can be edited, extended, remixed and shared with others, Apple said.

"Swift Playgrounds requires no coding knowledge, so it's perfect for students just starting out," the company said. "It also provides a unique way for seasoned developers to quickly bring ideas to life. And because it's built to take full advantage of iPad, it's a first-of-its-kind learning experience."

About the Author

David Ramel is an editor and writer at Converge 360.