Chapter 22: Generics (Generic Functions and Methods), page 298
Both listing 22.6 (“Your own map function”) and figure 22.1 (“myMap declaration”), which mostly does a great job of breaking down the myMap(_:_ declaration, describe the function thusly:
It’s the parentheses around U in the second parameter (as in, f: (T) -> (U)) that I question.
Around the T, sure; that’s what indicates a function (or closure) is expected. But around the U? The result of the function is not another function, so…what gives? The code appears to work identically without the extra parens:
Chapter 28: Interoperability (Adding an Objective-C Class), page 443
This isn’t so much an erratum as it is a suggestion for clarity in future editions.
The fourth paragraph (supported by Figure 28.23 generateDefaultImageOfSize: in Swift) advises:
Option-click on generateDefaultImage(of:) in NewContactViewController.swift to see how the method is exported to Swift
But that’s useless. At that point, the munging of the ObjC method name has already been done, and somehow we magically knew which name to use! Far more helpful would be to see how we came to know that.
After a fair bit of searching, I came upon a fantastic post on StackOverflow. (See also the links he posted as comments under the original question.)
Instead of the text as presented in the book, how about instructing the readers to select ImageFactory.h in the project navigator, then choose Navigate > Jump to Generated Interface? Boom. This shows exactly how the method is being exported to Swift, but BEFORE we’ve entered the code in the .swift source file. (Navigate > Jump to Original Source to return.)
I verified the technique works in Xcode 8.2.1; I have no idea about other versions.
Chapter 15: Structs and Classes (A New Project), page 168
KurtSchmucker posted in the chapter forum that the term “toolbar” (second line on the page, and in the label for Figure 15.7 “Xcode toolbar”) is misleading, as the reference is actually to the menu bar, as an application’s “toolbar” is normally contained within a window, as in TextEdit.
The “- and should be placed before -” part is meant to read as a sort of parenthetical aside. I can definitely understand how you were confused by the sentence. We’ll get it cleaned.
In Chapter 9, pages 89-90, two arrays are being compared for equality. The note on page 89 says the test will fail due to the order (“Find a triple rainbow” is in the wrong position). But the test also fails on this page and on page 90 (once the order has been corrected) since the first bucketList item differs (“Mr. Everest” versus “Mt. Kilimanjaro”).
Sorry if this seems trivial… Listing 4.21 on page 34 of print edition won’t work because d1 was declared as constant on the previous page. Changing that declaration to “var d1 = 1.1” fixes things.