Member-only story
Write SwiftUI Entirely on an iPad Using Swift Playgrounds
You don’t need to open Xcode or even own a Mac to get started with Apple’s new declarative design framework. Write and test simultaneously!

Here are the basics of what this tutorial is about:
When Swift first appeared in 2014, it was designed to be an easy first programming language. Semi-colons aren’t required to end each line, conditional statements don’t need to be inside brackets, and it’s not necessary to end every case of a switch statement with a break. This makes it easier for kids to write their first code without needing to constantly look out for missing punctuation. The language was made more accessible when Apple released the Swift Playgrounds iPad app in 2016, making it even easier to learn the basics in a classroom or at home, even without a computer.
Until June 2019, the only way to design a user interface for a Swift app was using storyboards, a drag-and-drop interface that stored its data in a complicated XML file. This all changed when Apple announced SwiftUI, a declarative language for designing user interfaces that can be instantly previewed. The Swift Playgrounds iPad app has recently added support for SwiftUI, as well as the Combine framework which provides new ways to handle asynchronous events.
Let’s see what SwiftUI allows us to do on iPad now that we could never do before.
Getting Started
If it isn’t already on your device, download the free Swift Playgrounds app.
When you open Swift Playgrounds, you go straight to the New Playground page. If you have opened the app before, you’ll see your previous Playground files here. If not, the screen will be mostly empty. Either way, there is a panel at the bottom of the screen that has the title Other Playgrounds. Tap the blue ‘See all’ button at the right end of this panel, and the panel should expand to show the Swift tutorials Apple provides. Scroll down to the Starting Points row, and tap the blue ‘See all’ button for that.
Now you should be able to see all the example projects that Apple provides, although there isn’t an example for SwiftUI at the time that I’m writing this.