Susan Harkins (406) [Avatar] Offline
#1
Please post errors find in the published version of iOS Development with Swift here. If necessary, we'll publish a comprehensive list for everyone's convenience. Thank you!

Susan Harkins
Errata Editor
Manning Publications
381501 (1) [Avatar] Offline
#2
I just bought this today and it comes with MEAP stamp version 10?

Thought this was live post publishing in Nov?
Susan Harkins (406) [Avatar] Offline
#3
Mobile versions should be on their way soon -- it takes two to four weeks. Please let me know if you don't hear something soon.

Susan Harkins
Errata Editor
supotuco (32) [Avatar] Offline
#4
Section 1.6 requires Carthage to be installed on the machine. Package managers are not mentioned in Chapter 1
538489 (1) [Avatar] Offline
#5
5.1.2 "Text Field", "You could also remove the @IBAction keyword from the convertTo-Miles() method because this is called from code now, and isn’t connected to an event in Interface Builder" appears to be incorrect, resulting in the error "Argument of '#selector' refers to instance method 'convertToMiles' that is not exposed to Objective-C" in XCode 9.2 (9C40b)

You may wish to omit this point entirely, or point out that "@IBAction" may be changed to "@objc".
Craig Grummitt (50) [Avatar] Offline
#6
Thanks for that 538489! As you worked out this is related to the Swift 4 change of limiting objc inference (@IBAction automatically infers @objc) - see Swift-evolution proposal "Limiting objc inference" for more info. As the book doesn't discuss objc for a few pages yet, I think your instinct might be right, and it might be simplest to just omit this point here.
Craig Grummitt (50) [Avatar] Offline
#7
Thanks supotuco for your feedback re Carthage - I've resolved this in the repo without requiring any errata. Check out the forum post related to this issue here.
Craine R (2) [Avatar] Offline
#8
There is an error in Listing 3.1 Overloading a function with different parameter names. In that you have it listed as there being 5280 feet in a km. This is incorrect, as there are 3280.84 feet per km. The calculation results in that section are based on the correct value, so it appears that it is just this code example where it is incorrect.

Incorrect Code
static let feetPerKm:Double = 5280
static func toKm(miles:Double)->Double {
    return miles * kmPerMile
}
static func toKm(feet:Double)->Double {
    return feet / feetPerKm
}


Corrected Code
static let feetPerKm:Double = 3280.84
static func toKm(miles:Double)->Double {
    return miles * kmPerMile
}
static func toKm(feet:Double)->Double {
    return feet / feetPerKm
}
Craig Grummitt (50) [Avatar] Offline
#9
Well spotted Craine R! We will be adding this to errata shortly.
Dottie (3) [Avatar] Offline
#10
In Chapter 9 Section 9.2.1 step 3 states "..Find Navigation Bar Item in the Object Library....". Should it read as "...Find Bar Button Item" in the Object Library?

Thanks! This is an awesome book!!!
supotuco (32) [Avatar] Offline
#11
Found the following error, 10.2.1 Instruction 3. It does not match the repo. Also the navigation bar disappears when you click on an item during a search.

Turn this off, too:
searchController.definesPresentationContext = true


Should be

Turn this on:
definesPresentationContext = true
Craig Grummitt (50) [Avatar] Offline
#12
Thanks for that feedback Dottie and supotuco, will be adding both of these to the errata shortly.
Dottie (3) [Avatar] Offline
#13
14.2 The code snippet for step 8 may have an extra } in it:
It is written like this:
booksService.getBook(with: barcode) { 1
(scannedBook, error) in 2
if error != nil { 3
// Deal with error here
return
} else if let scannedBook = scannedBook { 4
self.titleTextField.text = scannedBook.title 4
self.authorTextField.text = scannedBook.author 4
self.bookCover.image = scannedBook.cover 4
self.coverToSave = scannedBook.cover 4
self.saveButton.isEnabled = true 5
}
} else {
// Deal with no error, no book!
}

But the } in front of that last else appears to be causing an error. Should it be like this?:
booksService.getBook(with: barcode) { 1
(scannedBook, error) in 2
if error != nil { 3
// Deal with error here
return
} else if let scannedBook = scannedBook { 4
self.titleTextField.text = scannedBook.title 4
self.authorTextField.text = scannedBook.author 4
self.bookCover.image = scannedBook.cover 4
self.coverToSave = scannedBook.cover 4
self.saveButton.isEnabled = true 5
}
else {
// Deal with no error, no book!
}
Craig Grummitt (50) [Avatar] Offline
#14
Hi Dottie, you're right - the curly bracket is in the wrong place! It should be moved to the end, i.e.

instead of:

        self.saveButton.isEnabled = true
    }
} else {
    // Deal with no error, no book!
}


it should be:

        self.saveButton.isEnabled = true
    } else {
        // Deal with no error, no book!
    }
}
Monica_G (28) [Avatar] Offline
#15
Hi,

In section 7.1.2 "Size classes in Interface Builder" it wasn't clear in point 2 that I needed to click in the Document Outline or Canvas area to see the "use auto layout" and "use trait variations" options. I had only clicked on the Main.storyboard file in the project navigator area, which does not show those options in the file inspector. Once I clicked in the Document Outline area, then the options appeared in the File Inspector menu.

Anyway, it took me a few minutes to figure out why I wasn't seeing what is displayed in figure 7.6. I'm not sure if it's an errata item, but figured I would note it.

Monica

Monica_G (28) [Avatar] Offline
#16
Hi,

Minor typo in section 8.1. The checkpoint says to use the BookCase branch of

Chapter.7.3.StackViews-SizeClasses


But the branch is (no hyphen):
Chapter7.3.StackViewsSizeClasses


Monica_G (28) [Avatar] Offline
#17
Hi Susan,

I get the following error when I click on the link to the errata:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>582F61209393EB57</RequestId>
<HostId>
glBd0O0h0+Uon+tPoAYlFwcfJ07AMC9w2ZAse52B/95IvEDPH8HXFBZ0nAxF4qWqci2HNvVEfY8=
</HostId>
</Error>


Susan Harkins wrote:An updated errata list for iOS Development with Swift is available at https://manning-content.s3.amazonaws.com/download/0/d825bd1-76eb-4d9b-8b90-840651d469cb/Grummitt_iOSDevelopmentwithSwift__err3.html. Thanks!

Susan Harkins
Errata Editor
Monica_G (28) [Avatar] Offline
#18
Hi,

There is a minor typo in listing 8.3.4

The code in the book states:
var keyboardFrame = (userInfo[UIKeyboardFrameEndUserInfoKey]
                as? NSValue)?.cgRectValue()


But, there should be no parentheses at the end of cgRectValue
var keyboardFrame = (userInfo[UIKeyboardFrameEndUserInfoKey]
                as? NSValue)?.cgRectValue


And point 4 in that section is different than what is in the git repository. The book code has the following which does not compile:
guard let duration = userInfo[UIKeyboardAnimationDurationUserInfoKey] as? Double       
     curve = userInfo[UIKeyboardAnimationCurveUserInfoKey] as? UInt
            else { return }


The git repository has the following:
guard let duration = userInfo[UIKeyboardAnimationDurationUserInfoKey] as? Double
    else { return }
        
guard let curve = userInfo[UIKeyboardAnimationCurveUserInfoKey] as? UInt
    else { return }


In section 8.3.5 the book declares the firstResponder as a UIResponder? but it should be UIView? as in the git repository.

Book code:
import UIKit
extension UIView {
  var firstResponder: UIResponder? {
   //...more code
 }
}


Git code:
import UIKit
extension UIView {
    var firstResponder:UIView? {
    //..more code
  }
}
Monica_G (28) [Avatar] Offline
#19
Thanks!
Monica_G (28) [Avatar] Offline
#20
Chapter 11.2.3 - Archiving Objects. In the section "Adopting Codable protocol" the first step's code example is:

class Book: Codable {


But up to this point Book has always been a struct. And the github code has it as a struct as well:

struct Book: Codable {
Craig Grummitt (50) [Avatar] Offline
#21
Thanks for that Monica. I've requested this be updated in the errata.
Monica_G (28) [Avatar] Offline
#22
In SQLite section in Chapter 11 the code to update the booksFile property includes the following line:

if let bundleFilePath = Bundle().resourceURL?.appendingPathComponent("Books").appendingPathExtension("db") {


However, this returns a nil value, which results in an empty Books.db file.

It should be:
if let bundleFilePath = Bundle.main.resourceURL?.appendingPathComponent("Books").appendingPathExtension("db") {

423317 (2) [Avatar] Offline
#23
First paragraph on page 35 mentions variable name "quantity," but on preceding page at bottom the code sample lists the variable name as "quantitySoup."
Monica_G (28) [Avatar] Offline
#24
In section 14.11 "Downloading data from a web service", Step 1 code states:

let thumbnailURL = volumeInfo["imageLinks"]?["thumbnail"].string{


But it should be:

let thumbnailURL = item["volumeInfo"]["imageLinks"]["thumbnail"].string {


Note: "volumeInfo" needs to be obtained from the "item" dictionary.
407181 (1) [Avatar] Offline
#25
In section 2.8.2 middle of page 53 it says:
‘returns a version of the updatedPrices array that has been doubled.’
However, the multiplier factor in the book examples is 1.1 (in the git.hub playground samples there is a 2, so maybe it was changed sometime). The line should be something like:
'returns a version with the values in the updatedPrices array increased by 10%.'
Susan Harkins (406) [Avatar] Offline
#26
An updated list for iOS Development with Swift is available at https://manning-content.s3.amazonaws.com/download/5/451fb3d-32d9-480f-8741-7b283881be42/Grummitt_iOSDevelopmentwithSwift__err9.html. Some items on the list aren't errata, but updates to remain compliant with Swift SDK upgrades. Thank you for participating in the collection process. Your contributions are a great help to us and other readers.

Regards,
Susan Harkins
Errata Editor