A quick look at the Xcode interface

By this time, we should have created our first playground file, saved it somewhere on our local drive, and deleted the autogenerated content in the editor. This means we now have a clean slate as our starting point.

Before writing our first line of Swift, let's quickly look at some of the interface elements of Xcode. For now, these are a few areas you should care about.

A quick look at the Xcode interface

First up, we see the toolbar that sits at the top of the window. In the middle, we see the current status of our playground. When you first open up your playground, it might be doing some work before showing Ready. As soon as we make changes to our playground, that is, change or add some code in the editor, the status will change to Running, which means that Xcode is interpreting our instructions or recipe, as explained in Chapter 1What is Programming. On the right-hand side of the toolbar, there are some buttons to show and hide different editors, navigators, and other areas of Xcode, which are currently hidden and which we don't need right now:

A quick look at the Xcode interface

Below the toolbar, we have the actual editor. This is where we will be writing our Swift code. You might have noticed that the editor seems to be divided into two columns, where the column on the left has a white background color and the column on the right has a more gray color. The column on the left is the actual editor, where we are able to write our code. The column on the right is the result of running our playground (also called the results sidebar). This means that, if we want our program to output some text to the console, it will be shown in the right column. To give another example, if we programmed a small game, the actual game would be running on the right side.

A quick look at the Xcode interface

At the bottom, there's a button to show/hide the console and a play button. If we click on the play button, we tell Xcode to run our application. In a playground, this will happen automatically as we write our code and save our playground. You might notice that when the status at the top says Running, the play button will change to a stop button, which can be used to tell Xcode to stop running our application.

The right column, which shows the results of our application, is what characterizes a playground in Xcode. Instead of running our application on an iPhone (or a simulator), we simply get a small area (in the column on the right) to preview the result of our code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.156.250