Errata

iOS Swift Game Development Cookbook

Errata for iOS Swift Game Development Cookbook

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
ePub Page ebook
see my description

In chapter 1 the first code sample in the section "creating a component-based game layout" looks like it mistakenly uses code from the Objective-C version of this book. I was expecting to see swift code here.

Japhet Martin  Apr 17, 2017 
PDF Page 17
Create a Component Based Game Layout

The Component class is shown by example in Objective-C although this is a Swift text. Also, shouldn't the first class be @class Component as per the explanation (in Obj-C)?


“Solution

First, define a Component class. This class represents components that are attached to game objects—it is a very simple class that, at least initially, only has a single method and a single property:

@class GameObject;
@interface Component : NSObject

- (void) update:(float)deltaTime;

@property (weak) GameObject* gameObject;
@end

Next, define a GameObject class. This class represents game objects:

class Component: NSObject {

// The game object this component is attached to
var gameObject : GameObject?

func update(deltaTime : Float) {
// Update this component
}

}


Excerpt From: Jonathon Manning & Paris Buttfield-Addison. “iOS Swift Game Development Cookbook.” iBooks.

John Duckworth  Dec 28, 2015