Learn and Explore

In Swift Playgrounds you create small programs called “playgrounds” that instantly show the results of the code that you write. A single line of code can make amazing things happen. Interactive lessons teach key coding concepts, and additional challenges and templates encourage you to explore code in exciting new ways and to create something completely unique. There are even playgrounds that use Bluetooth to control robots, drones, and other hardware accessories. It’s easy to share your creations with friends, or record and post videos of your playgrounds in action.

Coding Concepts

Swift Playgrounds includes interactive lessons that use puzzles and experimentation to teach the following core coding concepts, and more:

  • Commands
  • Functions
  • Parameters
  • Loops
  • Conditional statements
  • Variables
  • Operators
  • Types
  • Initialization

Real Swift. Real iOS.

The Swift programming language was designed to be approachable enough to be your very first programming language. Swift is also incredibly powerful, used by professional developers to create thousands of apps in the App Store. Using Swift Playgrounds, you will code real programs within minutes and even as you become more proficient, you will never outgrow Swift.

Swift Playgrounds also gives you access to iOS frameworks such as UIKit, SpriteKit, SceneKit, Bluetooth, and Metal. And because you are coding and running your playgrounds on iPad, your code can respond to touch gestures or interact with hardware such as the accelerometer and gyroscope.

Experiment with Code

Sometimes the best way to learn is to explore on your own, and Swift Playgrounds is a great place to let your imagination run wild. In addition to the lessons that help you learn to code, Swift Playgrounds delivers new challenges on a regular basis so you can keep coming back to try something new. Some challenges are fun ways to play with code to create interesting effects, while others include engrossing puzzles that requires all of your coding skills to solve.

Additional templates included in Swift Playgrounds help you get started creating a playground from scratch. With access to thousands of APIs in the iOS SDK, you can create amazing playgrounds that explore the web, generate 3D worlds, experiment with physics, and much more.

The included playgrounds can be edited, extended, remixed, or completely reinvented. Collaborate with friends or reimagine them on your own.

Built for Touch

Because Swift Playgrounds was designed from the ground up for touch, you can create entire programs with only a few taps on the iPad screen. Unique coding features include:

  • QuickType for code. The Shortcut Bar intelligently presents the most likely next commands or values based on context. Its easy to write entire lines of code without touching a keyboard.
  • Touch to edit. Tap to edit a number in-place with a pop-over keypad, or touch a color value to display a color picker. You can even restructure your 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 a lot less typing.
  • Coding keyboard. Quickly type numbers and symbols commonly used in Swift coding by simply dragging your finger across a key to select one of the alternate symbols.

Swift Playgrounds helps you write correct code by identifying mistakes as you type, and offers suggestions to help correct the errors.

Command Robots, Pilot Drones, and More

Swift Playgrounds includes accessories playgrounds that teach you how to use Swift code to command LEGO MINDSTORMS EV3 robots that you build, guide a Sphero SPRK+ robot around the room, pilot a Parrot drone, or even teach a MeeBot to dance. Swift Playgrounds includes guided lessons for each accessory, as well as template starting points you can use to write your own programs that control the following devices:

  • LEGO MINDSTORMS EV3
  • Sphero SPRK+
  • Parrot drones Mambo, Rolling Spider, and Airborne
  • MeeBot by Jimu Robots
  • Dash by Wonder Workshop
  • Skoog musical instrument

Because Swift Playgrounds uses real Swift and iOS code with access to the Bluetooth radio on iPad any developer can create a playground to connect to additional robots and and devices, then share them with the world.

Create New Content with Xcode

Playgrounds were first introduced as a way to experiment with your code in Xcode, and now with Swift Playgrounds you can easily use those same playgrounds on iPad. iCloud Drive seamlessly shares your Mac playgrounds with your iPad, and changes you make on either device are immediately updated. This is especially useful when exploring iOS code that uses the iPad touch gestures, gyroscope, and other hardware features.

Become an Author

If you are already an experienced developer, you can create incredible playgrounds to share with the next generation of coders.

The interactivity of playgrounds combined with the power of the iOS SDK gives developers an entirely new way to express their creativity and skills. Playgrounds authors can now create experiences on iPad for new audiences — those just starting to explore code, others who crave new challenges, and advanced developers seeking to learn new techniques and technologies.

Swift Playgrounds has new features designed to take advantage of the immersive experience on iPad, including full-screen animations for topic introductions, assessment checks, and always-on live views. The format to use these new features is available to everyone on the Swift resources page, and can be used by experienced Xcode developers to create even more playgrounds and challenges. We can’t wait to see what Apple developers create to make coding even more fun and easy.