Errata for Expert Swift 1st Edition

Creating this topic to catch any typos and bugs in the 1st Edition of Expert Swift.

The title is sadly a copy of the original Advanced Swift book: Advanced Swift · objc.io

Did you really not come up with another name?
For me it‘s a really bad impudence.

Hi

Maybe this is the wrong forum (if so I apologize) I was wondering about the structure for the insert in chapter 2: Types & Mutation/Quad tree/Copying - the implementation of the insert method.
Isn’t it better to immideately check if the point exists in the region ”before” dive into the children and call insert on them
 isn’t that the point of the childrens, that they exist in the same region as the parent
 or am I missing something fundamental here?

1 Like

Thanks for the message, @chbeer! It’s fairly common for books to have the same title, but you are right, and we changed ours to promote the long-term health and easy searchability of both books. We call ours Expert Swift. Sorry for the last-minute refactor. :sweat_smile:

On second thought, after looking at the code, I think you are right. Although the code as-is, is not incorrect, you can save a lot of tree traversals by checking earlier as you suggest. Just move the guard region.contains(point) up to the top of the method. Cool.

I will update the download materials and online version to reflect that change. (There are other ways this type could be made faster such as using non-allocating storage for the points. There has been some discussion, and even a prototype for non-allocating fixed size arrays. Maybe we will see that in the Standard Library someday.)

The book is very much an original and an advanced companion to our Swift Apprentice book. When we were alerted that there was a book with the same title, we quickly decided to change the name. Even though there are not a ton of other names to describe an advanced book about Swift, we settled on Expert Swift. You can find that here: https://www.raywenderlich.com/books/expert-swift/v1.0/

Wow! I‘m really glad you did that! That‘s a really honorable move! :+1::100: Thank you!

1 Like

Awesome :slight_smile: And thanks for a really great book.

1 Like

I read the first chapter and you wrote lots of good material.

I noticed a few typos in the first chapter. I have a couple of other questions which may be errata but deserve separate posts.

Errata: Chapter One

Note: I’m reading the PDF version of the book with Preview. So some of the below issues may be a Preview issue.

  1. This first errata is more of a request: None of the book’s
    subsections appear in the table of contents. So it’s harder to navigate from the table of contents to a specific subsection:
    Screen Shot 2021-05-30 at 23.35.18
  2. When links are over multiple lines, the link is incorrect:
    • On page 36, https://github.com/apple/swift/blob/main/docs/TransparentAttr.md is broken over two lines into https://github.com/apple/swift/blob/main/docs/ and TransparentAttr.md. I can only click the first part and it sends to swift/docs at main · apple/swift · GitHub instead of swift/TransparentAttr.md at main · apple/swift · GitHub
    • On page 38, https://github.com/apple/swift/blob/main/docs/ABI/Mangling.rst is broken into https://github.com/apple/swift/ and blob/main/docs/ABI/Mangling.rst with the same result as above
    • On page 40, http://bit.ly/slava-types is broken into http://bit.ly/ and slava-types with the same result as above.
  3. On page 28 (Section The magic of SIL, subsection Raw SIL), a *magic.rawsil appears.
  4. In the Implementing a language feature section, all of the subsection titles have the same styling as the section titles.
1 Like

Wow. Thanks a lot for this [and your other posts]. (Some of the tooling issues are out of my hands but I will be sure to raise them on the appropriate channels.)

You’re welcome.

Some of the tooling issues are out of my hands

Which issues are tooling related? I can continue to document them as I read and send you direct messages to reduce noise in this post.

Hi,
Typo.
In chapter 11, Functional Reactive Programming, in the section: Triggering Request
In the second paragraph it says: open ”GuitarViewModel.swift”. I assume that should be ”BuildViewModel.swift”

Errata: Chapter 2

Same note as before

  1. The Modeling with types’s subsections titles visually match section titles.
  2. The incorrect link appears on the permuted congruential generator (https://en.wikipedia.org/wiki/ and Permuted_congruential_generator)

Errata: Chapter 3

  1. Typo (emphasis mine): Static dispatch is used, among other reasons, for global functions and methods declared in structs as well as methods on final classes.
    Fix: Static dispatch is used, among other reasons, for global functions and methods declared in value types as well as methods on final classes.
    Location: Bottom of page 77
  2. Typo: As expected, this outputs “Goodbye”
    Fix: As expected, this outputs “Bye”
    Location: Bottom of page 80
  3. Typo: greet still outputs “Hallo”, but leave is now in English and outputs Goodbye!?
    Fix: greet still outputs “Hallo”, but leave is now in English and outputs Bye!?
    Location: Top of page 81
  4. Not really a Typo: .compactMap { $0.data }
    Fix: .map { $0.data }
    Location: Code block of the Networker class on page 86
    Rationale: $0.data is non-optional
  5. Typo: Asking the delegate to provide information, like UIScrollViewDelegate’s numberOfSections(in:)
    Location: Third list item on page 94
  6. Typo: Broken link for the Understanding Swift Performance WWDC 2016 session (apple.co/ and 3n01j0w)

Maybe this is the wrong forum, but I just want to mention that in Chapter 8: Codable, there is one challenge, I wanted to see if my outcome was correct but couldn’t find the challenge solved in the repo, although, there is one folder called Challenge but is empty

@freak4pc @jellodiil Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hey @jairmg, sorry for the delay in the reply!
I might be missing something but the chapter ends with a second on Encoding and then with the chapter’s Key Points. I believe there’s no challenge for this chapter, unless I missed something.

We do use the terminology, “here’s the next challenge” in the chapter but it’s not a challenge per-se, since it’s a regular “by tutorials” section where you get all the code to complete the task. Let me know if this is what caused the confusion, perhaps it would be worth rephrasing it.

Seems to me the challenges folder is a mistake here.

Thanks again, and hope you’re enjoying the book!

Thanks @lekrans, that’s definitely the case. Probably an earlier iteration of that project :slight_smile:
We’ll be sure to grab that fix in the next edition.

Thanks again!

Congratulations on a great book. I am currently reading the Chapter 7 “Strings” and I don’t think the “UTF-16 binary representation” paragraphs are correct. Specifically:

If the 2 bytes start with 0xD8 (110110 in binary), those two bytes complete a character.

Isn’t that supposed to be the opposite? Also, it confusingly continues with:

This character is 4 bytes in size.

Hello, I’ve got bunch of errors like this this morning. Is the team aware of it?
Screen Shot 2022-01-19 at 11.30.33 AM

1 Like