Swift Playgrounds is a development environment for Swift that was released to macOS within Xcode on June 2, 2014, and later ported to iPad on September 13, 2016. The Mac Catalyst version of the app was launched on Mac in February 2020.
The goal of the app is to help users learn to code Swift, Apple's general-purpose, compiled programing language. By learning Swift, users will be able to code apps and programs for iOS, iPadOS, macOS, watchOS, tvOS, and Linux.
The app can also be used to quickly prototype both program functions, as well as user interface and user experience elements. Toy manufacturers quickly took advantage of Apple's robust app experience and have launched devices that let you turn playtime into learning to code.
In 2021, Apple announced a critical update to Swift Playgrounds on iPad — the ability to publish apps to the App Store directly from an iPad. Apps built on iPad can only be written using the Swift language, and users can only publish iPhone and iPad apps to the App Store.
Swift Playgrounds Features
Publishing
Users need iPadOS 15 and Swift Playgrounds to develop apps on their iPad. Completed projects can be uploaded to App Store Connect directly from Swift Playgrounds.
Since the app is built around teaching novice coders, it has features like code suggestion autocomplete and a library of icons for use during development. Developers can see their app update in a live preview window and even run the app to test its features within the development environment.
Projects built in Playgrounds are also universally compatible with Xcode, so users can move their project to Xcode and back as needed.
Environment
The app allows novice coders to test and render code in real-time. It can evaluate and display the results of a single expression as it is coded, giving immediate feedback to the coder.
This can decrease development time for experienced users, allowing them to maintain a constant workflow without resolving themselves to an arduous and inefficient trial-and-error process.
Typically, this kind of development environment is referred to as read-eval-print-loop, or REPL, and is lauded for its ability to encourage experimentation and learning. It also is particularly beneficial when it comes to quickly prototyping code with instant feedback.
Platforms
The app is available both on iPadOS and bundled with Xcode for macOS. Originally introduced and bundled with Xcode 6, Apple designed the macOS version of Playgrounds to give developers a place to quickly code and receive immediate feedback without recompiling every time the developer tweaks the code.
Another upside is that it gave developers a quick way to test user interface elements without first building the entire program.
On the iPad, Playgrounds serves not only as a development environment but also as a powerful educational tool. Users can download lessons and challenges, which are accessible offline, making it a versatile learning platform.
The iPad version comes bundled with a few lessons that teach young or inexperienced coders the basics of coding syntax. Coders will assist three characters, Byte, Blu, and Hopper, in achieving simple goals, such as navigating to goals or collecting gems.
These goals can be completed by filling in code, debugging scripts, and teaching coders the basic coding syntax.
Topics
The app starts out teaching novice coders about code syntax, simple commands, functions, loops, parameters, conditional coding, variables, operators, types, initialization, and how to fix bugs in code.
After mastering the fundamentals of Swift, users can download additional topics via "More Playgrounds" within the iPad. This allows users to use Playgrounds to learn more advanced topics, including ARKit, MapKit, camera access, and the ability to work with third-party accessories.
Third-party Accessories
Several third-party companies have created products for young coders alongside the iPadOS app.
One standout third-party device is Lego's Mindstorms EV3 kit. This programmable brick, equipped with three motors, a touch sensor, a color sensor, an infrared sensor, and a remote control, is a versatile tool for young coders. The kit's snap-on parts allow users to construct a variety of robots, adding an element of creativity to the learning process.
Another is Sphero, a company that creates a series of robots and toys capable of being controlled through Swift Playgrounds and Sphero's apps. Their Star Wars-branded toys are fun to play with but also a coding playground for teaching concepts surrounding logic paths and routines.
Swift Playgrounds Audience
Apple suggests students aged eight or older should be able to use the app for the iPad and encourages schools and teachers to incorporate their Everyone Can Code curriculum into the classroom.
Thanks to a large library of additional lessons that can be purchased from a subscription, even veteran coders can learn additional skills by downloading third-party lessons.
Currently, Swift Playgrounds is available in English, Dutch, French, German, Italian, Japanese, Korean, Portuguese, Simplified Chinese, Spanish, Swedish, Thai, Traditional Chinese, and Turkish.