-
Book Overview & Buying
-
Table Of Contents
Cocos2d Cross-Platform Game Development Cookbook - Second Edition - Second Edition
By :
Playground is a very versatile tool. Whenever you create a new file, you can start working on it immediately without any further setup. It has an inbuilt "Results" panel on the right-hand side that will compile your code in real time every time you make any changes to the file. There is also an "assistant editor" that provides a graphical representation of the changes we make in the code.
Create a new Playground file, name it whatever you want, and then open it up. Or, if you already created a file in the first chapter, you will already have a file in the Playgrounds folder, which you can open up.
Let's take a look at the Swift syntax in practice.
If you have some experience coding in other languages, you should know what a variable is by now. If not, then a variable is something that holds a value that can be changed at any time and, thus, it is called a variable.
In Swift, you can define a variable by the var keyword, similar...
Change the font size
Change margin width
Change background colour