Playgrounds – an interactive coding environment
Before we jump into building the app that we will be creating in later chapters, called Let's Eat, we need to understand the basics of Swift. An easy way to experiment with Swift is to use Playgrounds. It is an interactive coding environment, which evaluates your code and displays the results. Using Playgrounds gives us the ability to work with Swift without needing to create a project. It is great for prototyping a particular part of your app. So, whether you are learning or experimenting, Playgrounds is an invaluable tool. In order to create a Playground, we need to launch Xcode and click on Get started with a playground:
The options screen for creating a new Playground screen will appear:
First, name your new Playground SwiftFoundation
, and then make sure your Platform is set to iOS. Now, we can explore Playgrounds a bit.
When you launch the app, you will see five distinct areas:
Let's breakdown each area in Playgrounds:
- PLAYGROUND...