Add Swift files, images, and more to an app playground in Swift Playgrounds on Mac
In an app playground, you can add Swift files, images, Swift packages, and more to enrich the experience of your app.
Add Swift files, images, and other assets to an app playground
In an open app playground in Swift Playgrounds on your Mac, click at the top left to open the left sidebar.
Add any of the following:
Swift file: To add a file that you can enter code in, choose File > New Source File. You can add code to your new Swift file by clicking to open it, then typing in its coding area.
Text file: To add a text file you can enter text in, choose File > Add File. Locate the text file, then click Open.
Folder: To add a folder for organizing your files, choose File > New Folder.
Image: To add a photo or other image, choose File > Add File. Locate the image file, then click Open.
Swift package: A Swift package is a reusable component of code bundled with source files and other assets in a way that’s easy to use in your app playground. To add a Swift package to your app playground, choose File > Add Package, then enter the URL for the package. A Swift package can be shared across projects for various purposes.