Group Group Group Group Group Group Group Group Group

Errata for SwiftUI by Tutorials, 2nd ed

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

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.

Cheers

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.

Cheers!

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