Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
iOS 9 Game development Essentials

You're reading from   iOS 9 Game development Essentials Design, build, and publish an iOS game from scratch using the stunning features of iOS 9

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781784391430
Length 224 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Chuck Gaffney Chuck Gaffney
Author Profile Icon Chuck Gaffney
Chuck Gaffney
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. The Swift Programming Language 2. Structuring and Planning a Game Using iOS 9 Storyboards and Segues FREE CHAPTER 3. SpriteKit and 2D Game Design 4. SceneKit and 3D Game Design 5. GameplayKit 6. Exhibit the Metal in Your Game 7. Publishing Our iOS Game 8. The Future of iOS Game Development Index

Commenting in Swift

In our code snippets thus far, one might note notations with double forward slashes // or with forward slashes and asterisks /* */. These are how we can comment or make notations in our Swift code. Anyone who's coded in C++, Java, Objective-C, JavaScript, or other languages will see that Swift works practically the same.

Single-line comments are started with the double forward slashes, //, while multiline comments or a comment block begins with /* and ends with */.

Take the following example:

//This is a single line comment
/*
This is a comment block
that won't end until it reaches the closing asterisk/forward slash characters
 */

Commenting is used to help navigate your code, understand what it might do, and comment out lines of code we might not want to execute, but at the same time want to keep for later (that is, print() log calls or alternative starting property values).

Note

From Xcode 6 Beta 4 onward, we can also utilize the following comments:

// MARK:, // TODO:, and // FIXME. //MARK is equivalent to Objective-C's #pragma mark, which allows the programmer to label a section of your code that is accessible in Xcode's top breadcrumb dropdown list. // TODO: and // FIXME give us the ability to section off parts of code that we wish to maybe add features to in the future or debug. Even games with well-organized class structuring can be daunting to sift through. The addition of these additional mark-up tools makes planning and searching through our games' code that much easier to do.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime