Errata

Swift Development with Cocoa

Errata for Swift Development with Cocoa

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
PDF Pg 45. SomeExpensiveClass Example

The SomeExpensive Class example is meant to demonstrate the creation of a 'lazy' instance.

when accessing the first instance of the class, nothing should be printed, as the instance has already been created.

Only the second class should produce an output, according to to the documentation.

When run in playground BOTH classes behave the same and output the println.

Brian Jones  Feb 09, 2015 
Printed Page Preface
.

Probably not worth a correction, but early in the preface you have the statement that 乬The original Macintosh computers were mostly programmed in C, using a library called Toolbox.乭

That's not really true. The earliest Macintosh software was written in Pascal (Object Pascal). Some time around System 7 there was a change to C++, but that's a long way from the original Macintosh computers. It was possible to write software in C using MPW or Lightspeed (later THINK) C, but even then it was a little tricky because the Toolbox libraries were still written in Pascal and argument order was always an issue. I don't remember when the Toolbox was rewritten (if ever!) to obviate the requirement for the "pascal" keyword in C programs.

- Larry

Anonymous  Mar 23, 2015 
ePub Page 40
towards the top

myArray.removeAtIndex(4) should be myArray.removeAtIndex(0) for removing the first element

Parthasarathy Gudivada  Sep 17, 2014 
PDF Page 44
3rd code example

Code example does not work in Playground.
To actually use the function "sqrt", one needs to import e.g. Darwin or Foundation first.

import Darwin
class Rectangle {
var width: Double = 0.0
...

Andreas Gabriel  Jan 25, 2015 
PDF, ePub Page 79
First code block

The code line
(notification: NSNotification!) in
(2nd line before the end of the code block at the top of the page) appears to be incomplete.
I'd say there is a for before the first bracket and a collection after the word "in".
This error is found in the mobi file and in the PDF (I have the ebook version).

Pau Pachès  Mar 02, 2015 
PDF Page 116
code at the bottom

// Display this text
self.textLabel?.text = self.url?.host

in xCode 6.1 the "?" after "textLabel" gives an error.

In the same code at page 117:
// Give the image view the loaded image
self.imageView?.image = image

The "?" after "imageView" also gives a compiling error.

Casper Bach Andersen  Nov 10, 2014 
PDF Page 117
Point no 7

Point 7 says:
“Make the view controller the table view’s data source and delegate.”

But reading from the start of the book, it is unclear how this is done. I had to seek tips elsewhere.

Casper Bach Andersen  Nov 10, 2014 
PDF Page 130
Code Example

Use:
// Add them to the main path
bezierPath.appendBezierPath(circlePath)
bezierPath.appendBezierPath(squarePath)

instead of:
// Add them to the main path
squarePath.appendBezierPath(circlePath)
bezierPath.appendBezierPath(squarePath)

Matthias Dierker  Jul 14, 2015 
PDF Page 225
at the very top

The code is not working for me unless I change "object: self," to "object: nil,".

Daniel Seehof  Dec 19, 2014 
PDF Page 285
Point 4. in "Implementing a Table View"

"Is Initial View Controller" needs to be checked in Table View Controller's Attributes Inspector.

Casper Bach Andersen  Nov 12, 2014 
PDF Page 397
Point 5 code example at top of page

self.loadPageWithNumber(i)

gives xCode Error: 'ViewController' does not have a member named 'loadPageWithNumber'

Casper Bach Andersen  Nov 13, 2014 
PDF, ePub Page 475
Top code example

The end of this code line is missing:

observer = NSNotificationCenter.defaultCenter().addObserverForName(UIContentSizeCatego

The page number is from the PDF version.
In the ePub version some of the code is also invisible.

Casper Bach Andersen  Nov 10, 2014 
Other Digital Version 3344
step 16

Should be applicationDidEnterBackground, not ...WillEnter...

Ronnie Pitman  Mar 22, 2015 
ePub Page 8008
Point 3

[Page number refers to kindle read position. Kindle (App for iOS) has no page numbers.]

After dragging in a collection view controller, "is initial view controller" must be checked.

Bernd Stahlbock  Jan 25, 2015