Setting Up Your Swift Playground App Project

Ryan Du
3 min readApr 8, 2022
courtesy of apple

Apple recently announced their annual developer conference, WWDC 2022 along side their annual student coding challenge, the Swift Student Challenge. This year however, there has been one big change to the format of the Swift Student Challenge. Instead of requiring applicants to submit a playground, the Swift Student Challenge now requires the submission of a Swift Playground App with the .swiftpm format.

Swift Playground Apps are a new feature to swift playgrounds that apple released in December of 2021. It allows you to build apps using just the Swift Playgrounds app on an iPad. Swift Playground Apps can be exported directly from Swift Playgrounds as a .swiftpm file, which is what you’ll be required to submit for SSC 2022.

Setup Your Playground App on Swift Playgrounds

To setup a swift playground app on an iPad, download and open the Swift Playgrounds app and hit “App” on the bottom Left Corner. From there, click on “My App” to open your new App project and you are presented with a code editor and everything you need to build your app.

highlights location of new app button and my app project

Swift Playground Apps only support SwiftUI, so a default ContentView is added in for you. You can add new swift files by clicking on the page icon on the top right of the side bar. When it comes time to export your app to share with a friend or submit to apple for the Swift Student Challenge, click the three dots on the top right > Share Project, and you can export your app in a .swiftpm file.

highlights location of share project button and new page button

Setup Your Playground App on Xcode

To create a new swift playground app on Xcode, open Xcode and click “Create a new Xcode project” or go to File > New > Project. This will take you to the selection window where you can choose a template for your xcode project. Select “Swift Playgrounds App” and hit Next.

Give your app a name, hit next, and select a location to add your new Swift Playground Project. For those of you who’ve used Xcode before, you might expect a folder with all the contents of your project, but that’s not the case for swift playground app projects. Xcode generates a .swiftpm file for you in the directory you selected and everything related to your project is housed in that one .swiftpm file.

There! Swiftpm mystery solved, thats all it is to the new file format! Not too shabby after all. Now we’re both familiar with how to export your swift playgrounds app project from both a Mac and an iPad.

Good luck if you are applying for the Swift Student Challenge this year and I hope this was helpful along your journey!

Want to Connect?
Feel free to drop by on twitter!

--

--

Ryan Du

student, developer, ml enthusiast. WWDC ’21 scholar. I code.