Creating a playground

When you open Xcode, it will greet you with the following welcome screen:

If you don’t see this screen, it’s most likely because the “Show this window when Xcode launches” option was unchecked. You can also open the screen by pressing Command-Shift-1 or clicking Window\Welcome to Xcode from the menu bar.

From the welcome screen, you can jump quickly into a playground by clicking on Get started with a playground. Click on that now and Xcode will take you to a new screen:

From here, you can name the playground and select your desired platform. The name is merely cosmetic and for your own use; when you create your playgrounds, feel free to choose names that will help you remember what they’re about. For example, while you’re working through Chapter 2, you may want to name your playground Chapter2.

The second option you can see here is the platform. Currently, this can be either

iOS, macOS or tvOS.

The platform you choose simply defines which template Xcode will use to create the playground. Each platform comes with its own environment set up and ready for you to begin playing around with code. For the purposes of this book, choose whichever you wish. You won’t be writing any platform-specific code; instead, you’ll be learning the core principles of the Swift language.

Once you’ve chosen a name and a platform, click on Next and then save the playground. Xcode then presents you with the playground, like so:

New playgrounds don’t start entirely empty but have some basic starter code to get you going. Don’t worry — you’ll soon learn what this code means.

results matching ""

    No results matching ""