Chapter 8. Playing on the playground
This chapter covers
- Swift Playgrounds
- Frameworks
- Types of things
This chapter introduces you to Swift Playgrounds, an Apple app that allows developers to write code and see the results immediately—without having to run the app. We’ll also begin discussing the different ways you can manipulate and store things in your code. This chapter will be interactive. You’ll create something while also learning.
Swift Playgrounds is a helpful interactive tool that provides quick feedback on the code you’ve written. Recall that in part 1, when you created apps, you ran them several times before you were finished writing them, to make sure they still worked. That’s because Xcode needed to compile them into a format that the iPhone could work with, and it checked for errors in your code during that process. Chapter 1 explained this process:
- Writing code
- Compiling it
- Running it
Playgrounds provide you with much faster feedback because it doesn’t require you to run the code. It takes no time at all to compile and give you almost immediate feedback, so it’s a great place to play around (see what Apple did there?) and learn. Let’s get started with Swift Playgrounds.
Open Xcode and this time, instead of clicking Create a New Xcode Project, click Get Started With a Playground—the first option, as shown in figure 8.1.