Errata for SwiftUI by Tutorials, 2nd ed

Creating this topic to catch any typos and bugs in the 2nd Edition of SwiftUI by Tutorials.

1 Like

Ch. 9: State & Data Flow page 250
The source code shown in Profile/UserManager.swift for the third step is NOT in EITHER version of the UserManager.swift file for ‘Starter’ or ‘Final’.

There is a major FUBAR in the source code for CH 9 and the actual source code.
I was almost finished with the 1st edition book when I noticed an update and started over. Chap 9 was difficult to process and the source code you have needs to be updated to match the book is my guess.

MountainAirport applications Mock Data has a serious bug…

Go into System Settings preferences and set your time clock to manual and 11:30PM.

Then go run the app and look at Departures… There will be ZERO planes in the air. 100% of them will be in a Departed or Canceled state.

If you look into Flight Information and how it’s calculated…

  let scheduledHour = Int(Float(idx) / 1.75) + 6

What happens is ‘scheduleDay’ doesn’t appear to roll over.

Why does this matter? :slight_smile:

Because last night I was working in Chapter 12 - Conditional Views page 326.
It’s IMPOSSIBLE to select “Departures” and then tap on ANY “On Time” or “Delayed” flight. They will not exists if you’re burning the midnight oil.

Just to complete the exercise I ‘fudged’ the isCheckInAvailable() function to also include “Departed” so I could get a hit that would fire my Action Sheet.

If I get around to fixing the mock data I’ll post the fix. With WWDC wrapping up this week I’ve got too much to process at the moment.

Hopefully this helps someone out there.


Chapter 13 Page 342 - Drawing & Custom Graphics
Author suggests replacing the rectangle with another shape and noticing the results.

On page 341 the shapes listed are Circle, Ellipse, Rounded Rectangle and Capsule.

If you change the current code with ‘Rounded Rectangle’ Xcode 11.5 gives the following error at the ZStack { line: Unable to infer complex closure return type; add explicit type to disambiguate.

Not a show stopper but it would be very kind of the author to mention why and/or to suggest NOT using that one. :slight_smile:

Bottom of Page 342 has formatting errors in the PDF. The first two lines are CODE and the rest are NOT but they are formatted to imply a code block.

The next line of code starts with:
Path { path in

Everything between that should be standard chapter text and not highlighted as a code block.

Cosmetic item but a notable bump in the road of what is otherwise a very good chapter.

Chapter 16 page 406 - Testing and Debugging
for func testAddingTwoDigits()

It would have been ideal if the author had suggested this type of assert with TEXT:
XCTAssert(displayText == "8.0","Expected 8 but found \(displayText)")

The reasons are if the errors are logged it makes it super easy to write a bug and see the issue. Might be an app bug or a test bug because the UX behavior changed.

Great book and well worth my time.


Chapter 16 graphic says 18 in the background image :grin:

Hello, @skiwalker! Thank you for submitting this feedback! We’ve noted it for future edition correction! Thank you!

Thank you for this great book! I found some minor issues while reading:

Chapter 3, page 51: A NavigationView is visible in the code, but it is not mentioned at all. Probably code from chapter 4. The final project in chapter 3 also does not include any NavigationView.

Chapter 4, page 75: The storyboard in the starter project does not contain a UINavigationController, but the text expects that there should be one: “Double-click in the hosting controller’s navigation bar and set its title to RGBullsEye.”. Either the storyboard should contain a navigation controller or it should be mentioned in the text that one should be added.

1 Like

Chapter 4, page 84, second bullet point should be “Implement the makeUIView method to instantiate…” instead of “Implement the make method”. Third bullet point should b3 updateUIView.

hi José! thanks for spotting these! I used a NavigationView in the first edition, to make the dark colorScheme work, but it messed up the layout, and it turned out it wasn’t necessary. I should’ve updated those instructions.

On page 75, I think I decided to embed in a navigation controller just to get the nav bar, as somewhere to put the title. But then forgot to include the instruction.

On page 84, I use make and update as generic terms, in contrast to the actual method signatures makeUIView(context:) and updateUIView(_:context:). I’ll just use the method signatures in the next update.

Hi Audrey,
thank you for this great book, really enjoying it.

Another issue, chapter 7, page 152: Something odd about the Components folder in the starter project, it doesn’t exist in Finder and right-clicking in to add WelcomeBackgroundImage.swift results in that the Documents folder is shown as the saving location. This does not happen with other folders. Deleting the folder and re-adding it will solve this issue.

hi José! thanks for spotting this — paging @jeden

Thanks a lot for reporting this. I’ll fix it.
And thanks @Audrey for pinging me.

Hello, just finished the book. Enjoyed it! Nice job! I have a few observations on things that may need attention.

  1. Chapter 2; section on Bindings reads "“So back to that $. It’s actually pretty 8cool and ultra” … Cool seems to be misspelled.
  2. There are several places where the numbering seems to be incorrect. Items that should be numbered all have “1.”; for example, Chapter 9, section Cleaning up there are seven “1.”. Another example is Chapter 13 towards the end of the section Scaling drawings in views there are back to back “1.”. There are probably others …
  3. There are a few places where book text got formatted as code; for example, chapter 13 section Drawing lines with paths has some book text in between a couple of chunks of code but its all formatted as code. Also, same chapter section Drawing dashed lines has some book text formatted as code towards the end of the section.

I do have one question: is there an updated coming to include changes announced in WWDC 2020?


Hi, thanks a lot for reporting these issues. I guess you read the epub version, because I can’t find these issues in the PDF version.
And we’re already working on a new version of the book updated to WWDC 20.

@cupofjoe Thanks for the feedback. The next version will have some tweaks to the mock data to handle this an a couple of similar cases. I’ll check into the error on Rounded Rectangle for a future update.

Is there any ETA for updated Swift UI book and will it come as a free upgrade?

Thank you for your message! We are working on a 3rd edition now with a target publishing date of Fall 2020. We’ll keep you posted!

1 Like

There’s a small typo in chapter 15 on page 383. First instruction to update preview has odd amount of numbers in grid (same as next one, which’s supposed to crash)

Hello! Thank you for your feedback! I’ve alerted the team. Cheers!

Chapter 8, page 218: self.showAnswers.toggle() could be used instead of !self.showAnswers

Chapter 9, page 227:
“Create a new SwiftUI file in the Practice group and name it ScoreView.swift”

This file already exists on the file system and you will be asked to replace it.

Chapter 9, page 228: “Next, add two properties to…”

It is not mentioned anywhere that a SwiftUI View called ScoreView should be created.