So Everyone Talks About Swift Playgrounds, But What Is Swift and SwiftUI?

As you've made it this far I'm sure you're already aware of Swift Playgrounds, something that Apple describes as 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". This wonderful description has teased you with a hint of what Swift is all about, but nothing about the illusive SwiftUI. let's dive in and find out more about each of them. First...

Swift, its what the playgrounds are all about!

The Logo of Apples Swift Programming Language, a simplistic white swift bird flying over an orange background.
Swift Logo

This is the core language, that underlies everything. Apple sees it as its future when it comes to development and not just for education, but for real professional application development too. This is also why I think it's a fantastic place to start educationally, if you want to take it further then there is nothing stopping you, the only thing you change is the editor you write your code in. You want to define variables, create loops, make conditional decisions, apply arithmetic operations etc., this is what you use. While it can print simple strings and capture text input, by itself this isn't enough to create full blown applications.

NOTE: Sometime the use of the word Swift can be a little confusing as it can be used as a general term that covers everything that the programming language can do or it can be used as a more specific term that refers to just the core language.

Swift equivalent Scratch Block Categories
A Selection of Scratch Block Categories

Using Scratch's block coding as an example, Swift is sort of equivalent to the block Events, Control, Operators Variables and My Block categories. If you think what this covers it isn't about visuals, sound or communicating with the outside world, it is all to do with the behind the scenes work that gets done. Be it in Swift, Scratch or Python etc., the concepts are applicable to them all. Next...

SwiftUI, its where the application magic takes place!

The Logo of Apples SwiftUI Extension, a simplistic black swift bird flying over a light to dark blue background
SwiftUI Logo

This provides you with what you need to create a User Interface or UI. Apple describes it as a framework that "provides views, controls, and layout structures for declaring your app’s user interface" and providing "event handlers for delivering taps, gestures, and other types of input to your app". In other words this is the bit that lays out all the buttons and lists etc. on the screen and captures all the inputs from keyboards, mice or touch. 

SwiftUI equivalent Scratch Block Categories
A Selection of Scratch Block Categories

Going back to Scratch and block coding again, SwiftUI is sort of equivalent to the block Motion, Looks and Sensing categories. This time it's all about getting things on screens and reading input. Where previously with Swift the concepts are applicable to many languages, SwiftUI is designed to be used on devices that have a screen and a way to interact with it.

But what to learn first?

Hopefully you now have a sort of understand of what Swift and SwiftUI are all about and you're able to make an informed decision thinking about what you want to get out of Swift Playgrounds.

SwiftUI

Images of the Get Started with Apps and Keep Going with Apps playgrounds
Apps Playgrounds

If you're looking for that fast entry into exploring application development that doesn't include too much complexity, then diving straight into the "Get Started with Apps" and then the "Keep Going with Apps" playgrounds could be the route to take. You do get exposed to parts of the core language where needed but this is intermingled with all user interface elements. This could be more applicable to the masses who don't have goals of becoming coders but a desire to creating an application. It also wouldn't stop those who end up more interested in the subject going back and revisiting the core language playgrounds later.

Swift

Images of the Get Started with Code, Learn to Code 1 and Learn to Code 2 playgrounds
Code Playgrounds

If you're looking for a path where you learn the core language first you have a couple of choices. They both cover the same topics, one in a bit more depth. You can either chose to go through the "Get Started with Code" playground or the "Learn to Code 1" and "Learn to Code 2" playgrounds that provide more depth. With these instead of working towards creating a working application you are controlling characters moving around an isometric world. It may seem a bit Mickey Mouse at first, it does allow the learning of the basic concepts.

There is no single route to follow

There is no right or wrong order to learn these. It could be that all you want to do is have a go at creating an application and don't want to take it any further. It could be that after learning all about creating applications you want to better understand the core language. It could be you want to learn the core language and then build upon this by creating an application.

The important thing is that once you feel you have a level of confidence and knowledge about what you're doing (don't ever wait till you're 100% as that's impossible as new things come out all the time) carry on exploring. The playgrounds listed above aren't the only ones that exist, there are loads! Bring bits together from other playgrounds to create your own personalised and unique playground and then share it with the world.

Finally...

Coding isn't something you can explain to others after reading a forum post, get out there and get your hands dirty. Half the fun is playing with Swift Playgrounds yourself, it's not exclusively reserved for people under 18. Yes coding when it doesn't work can be frustrating but keep going, share your troubles, get through it and then share your experiences. Forums like this are a great way to support each other and together we'll all learn something.

Tagged in: Swift Playgrounds, Swift, SwiftUI, App Development

All Comments

Posted on September 12, 2022

I love this summary—very well explained and helpful!

Maximum file size: 400MB

Insert a video

Insert an image

Insert an image

125: 125
220: 220

This action can’t be undone.

Are you sure you want to continue? Your changes will not be saved.