Book Image

Learning iOS 8 Game Development Using Swift

By : Siddharth Shekar
Book Image

Learning iOS 8 Game Development Using Swift

By: Siddharth Shekar

Overview of this book

<p>Game development has been simplified with Apple's new programming language—Swift. If you're looking to start learning iOS development then you'll get everything you need - from&nbsp;the absolute basics such as the Xcode interface and takes you all the way to Swift programming.</p> <p>You will take a walk through the creation of 2D and 3D games followed by an introduction to SpriteKit and SceneKit. The book also looks at how game objects are placed in 3D scenes, how to use the graphics pipeline, and how objects are displayed on mobile screens. You will also delve into essential game concepts such as collision detection, animation, particle systems, and scene transitions. Finally, you will learn how to publish and distribute games to the iTunes store.</p>
Table of Contents (18 chapters)
Learning iOS 8 Game Development Using Swift
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Operators


Operators are used in computer languages to perform various operations on variables. It could be an arithmetic operation (such as addition), a comparison operation to check whether a number is larger or smaller than the other, a logical operation to check whether a condition is true or false, or an arithmetic assignment such as increasing or decreasing a value. Let's now look at each type in detail.

Arithmetic operators

Computers were initially made to perform numerical operations such as addition, subtraction, multiplication, and division. In Swift also, we have operators such as +, -, *, /, and %.

Let's declare two variables, a and b, and initialize them with values 36 and 10. If you want to make a single-line initialization in Swift, you can do it as shown in the following snippet of code:

var a = 36, b = 10

You can also use the semicolon to separate them, as shown here:

var c = 36; var d = 10

This is useful if you want to initialize variables of different types. Now let's use operators...