Learning Swift

Errata for Learning Swift

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. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Safari Books Online
9
Chapter 6, 6th paragraph

The following sentence is printed: "The UITableViewController is the other object we’ll be using a lot to make our UI. It is a subclass of UITableViewController and is designed to control a table view." UITableViewController can't be a subclass of itself, so one of these class names is in error.

Note from the Author or Editor:
The line should read as "The UITableViewController is the other object we’ll be using a lot to make our UI. It is a subclass of UIViewController and is designed to control a table view."

Matthew Pounsett  Apr 03, 2018 
Safari Books Online
9
Chapter 6, Improving the Selfie List

After step 2 (Update cellForRowAt indexPath) there is this paragraph: "This isn’t hugely different from how it was before; all we are doing now is using two more elements of the table view cell, subtitle and imageView, and giving them appropriate values to show." "subtitle" is monospaced along with imageView as if to reference an object attribute, but there is no attribute "subtitle" in the preceding code. Should this have been "detailTextLabel" instead?

Note from the Author or Editor:
The line should read: This isn’t hugely different from how it was before; all we are doing now is using two more elements of the table view cell, detailTextLabel, the subtitle of the cell, and imageView, and giving them appropriate values to show.

Matthew Pounsett  Apr 03, 2018 
Safari Books Online
12
Chapter 9, Testing Our New Model, Step 3

In the code for testLocationSelfie() the text passed to createImage has an unprintable character and no close quote. let newImage = createImage(text: "ߐᢩ

Note from the Author or Editor:
The code line with the unprintable character should read as: let newImage = createImage(text: "🐑")

Matthew Pounsett  Apr 03, 2018 
Safari Books Online
13
Chapter 10, Connecting the Settings into our Hierarchy

Figure 10-1 shows the return button from the Settings view controller to be "Back" but the button in Xcode at this point says "Selfies". Either the screen grab in the book is incorrect, or there are steps missing that would add a custom button to the Settings view. The button in the Settings view, which appears to have been automatically added, seems not to be editable. It's likely the screen grab was taken from an example that included steps that didn't make it into the book.

Note from the Author or Editor:
The screenshot is from interface builder in an earlier version of Xcode. Apple updated the interface builder so that instead of showing back it now correctly shows the title of the controller you would be going back to. The different title doesn't change the app though, all will still work fine.

Matthew Pounsett  Apr 05, 2018 
Safari Books Online
17
Chapter 13, Building the UI

Step 5, "Drag an empty UIView into the main view of the new navigation controller." A UIView doesn't appear to be something you can add to a Navigation Controller, and that doesn't match with the pattern already set from other modifications to previous controllers anyway. It seems likely this is supposed to be added to the new View Controller, not the Navigation Controller.

Note from the Author or Editor:
Step 5 should read as: Drag an empty UIView into the main view of the new view controller.

Matthew Pounsett  Apr 05, 2018 
Safari Books Online
17
Chapter 13, Connecting the UI

Steps 4 and 5 read: Control-drag from the cancel button into the CaptureViewController class and create a new action called close. Control-drag from the cancel button into the CaptureViewController class and create a new action called takeSelfie. Clearly the cancel button shouldn't be linked to taking a selfie. It looks like this is a cut&paste error and step 5 should be to drag from the gesture recognizer.

Note from the Author or Editor:
Step 5 should read as: Control-drag from the gesture recogniser into the CaptureViewController class and create a new action called takeSelfie.

Matthew Pounsett  Apr 05, 2018 
Safari Books Online
17
Chapter 13, A Camera View

All of the steps in A Camera View are related to adding code to the PreviewView Class. However, some of this code is supposed to be added to the CaptureViewController class. See, for example, the instructions to override layoutSubviews() and viewWillLayoutSubviews(). viewWillLayoutSubviews() isn't inherited from UIView, so following the instructions as written here will result in a "Method does not override any method from its superclass" error. Readers are advised to carefully check the sample code from the book's github repository and compare it to the instructions in this chapter.

Note from the Author or Editor:
Step 7 on page 228 inside the A Camera View section should read as: Inside our new PreviewView create the previewLayer property:

Matthew Pounsett  Apr 05, 2018 
Safari Books Online
17
Chapter 13, Talking to the Camera

The book switches from modifying the PreviewView class to modifying the CaptureViewController class without saying so.

Note from the Author or Editor:
Step 1 (pg 234) of Talking to the Camera should read as: Open CaptureViewController.swift in the main editor and create a completion handler property:

Matthew Pounsett  Apr 05, 2018 
ePub
Page 17
Fig 1-17 and Fig 1-18

Sorry, I do not see page numbers on my Kindle version. I have XCode version 10.1 and in my version the position of the Object Library button is different from Fig 1-17. The button is on the top left of the list of editors (Standard, Assistant, Version) The Objects list (Fig 1-18) appears in the centre pane of Xcode, to the left of the editors pane, not under the Inspectors panes on the right of the Xcode window. I am not sure tI would call this an error, just a minor presentation variation, maybe related to different XCode versions (?). All the require functionality is probably the same. I am just at the early stages of the book. Very probably all will become clearer as I progress through the book and develop the actual apps. I can send screenshots of my variant of the location of the Object library button and list of objects (Fig 1-17 and Fig 1-18), if this would be helpful. BTW I am really enjoying the book and I am looking forward to progressing through to the end.

Note from the Author or Editor:
Unfortunately Apple changed Xcode between us writing the book and now. The object library has moved from the right side underneath the inspectors to a button to the left of the editor configuration buttons on the top panel of Xcode.

Anonymous  Nov 24, 2018 
Printed
Page 134
Step 9, code lines 7 and 8

The code for step 9 line 7 is missing a close parenthesis, and line 8 contains an unhandled exception (presumably what was intended was "try?" rather than just "try").

Note from the Author or Editor:
The code lines 7 and 8 should read as: newSelfie.image = createImage(text: "💯") try? SelfieStore.shared.save(selfie: newSelfie)

Chris Hennes  Aug 22, 2018