官术网_书友最值得收藏!

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.

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:

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 pided 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.

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.

主站蜘蛛池模板: 凭祥市| 固始县| 五大连池市| 新河县| 常熟市| 溧水县| 延庆县| 九龙城区| 日喀则市| 宜宾市| 隆子县| 广安市| 江西省| 合作市| 吴江市| 韩城市| 亳州市| 正镶白旗| 繁峙县| 河西区| 巨鹿县| 分宜县| 小金县| 湾仔区| 安新县| 泰兴市| 江孜县| 额敏县| 松滋市| 余庆县| 平山县| 卢湾区| 龙岩市| 名山县| 鄯善县| 加查县| 明水县| 望江县| 惠东县| 香河县| 安新县|