iOS Apprentice 8th Ed: Errata - Various Chapters

Hi there, hope this is the right category for this…

Went thru the first 8 chapters and they were really great and helpful… Found a bug in chapter 7 that stopped me dead in my tracks and made me go to the Final Code files for the chapter…

On page 281 (reading on iPad Mini - so probably different for you), the book says this:

    .onAppear() {
        self.startNewGame()
    }
  .background(Image("Background"))
}
.navigationViewStyle(.stack)   /* Problem line  */

}

And it didnt work no matter what I tried… So i went to the final code files for chapter 7, and it was actually this:

    .onAppear() {
        self.startNewGame()
    }
  .background(Image("Background"))
}
.navigationViewStyle(StackNavigationViewStyle())   /* correct code */

}

Once I changed it, everything worked great… It was really nice to have those code files available to compare! But figured I’d let you guys know to possibly fix it in future versions, or help someone new who ran into the same issue…

Theres also another issue with the random # generator where you use from 1 through 100 in multiple places (after the initial 1…100 code), but that one is easy to figure out…

4 Likes

Hey, @jamesh!

Thanks for the heads-up! Feedback like this is incredibly helpful.

SwiftUI was in a fair bit of flux when I was writing the Bullseye chapters, and a surprising amount of the code got invalidated as each new beta version of Xcode came out. It looks like we missed one of the changes. I’ve made a note of the error in the text, and will see about getting it corrected.

— Joey

1 Like

Hey @accordionguy, I get it… Finding a book that’s up to date with the latest version of everything has been hell… This is the first time using a digital book to learn a language, and surprisingly its a lot easier with an iPad than paper! It does give incentive to get through the book quickly before the next version invalidates everything again :slight_smile: Honestly, I expected a lot more problems with the new version of Xcode, etc - but the first 8 chapters have been smooth other than the .stack thing… Loving the book so far - been very helpful

the “From 1 through 100” issue with the random # generator and slider happens in multiple places in multiple chapters surrounding other code… I tried typing it in, but it didnt work, so i went back to the 1…100 way which was how it was originally presented…

Hi @accordionguy

Gonna add this here and take the "“CH 7” off the title of the thread (if i can) so I don’t have a new thread for every typographical error…

Chapter 10 - p 397 (iPad mini - your page # may be different - but its two pages before the end of Chapter 10)

Found another one that I had to go to the final source code to figure out… It’s simple now that I look at the correct code, but the break between the two equal signs confused the hell out of me… Especially when it was right in the middle of syntax with “$0.id” in it, so it was the wild west in syntax already :slight_smile:

Book code:

.onTapGesture {
if let matchingIndex = self.checklistItems.firstIndex(where: { $0.id =
= checklistItem.id }) {
self.checklistItems[matchingIndex].isChecked.toggle()
}
self.printChecklistContents()
}

Correct code from Ch 10 - final source code:

      .onTapGesture {
        if let matchingIndex =
          self.checklistItems.firstIndex(where: { $0.id == checklistItem.id }) {
          self.checklistItems[matchingIndex].isChecked.toggle()
        }
        self.printChecklistContents()
      }
    }

Once again, thanks for the feedback, @jamesh! I’m going to see about getting the book code to match the source code.

1 Like

@accordionguy Great! I’ll try not to get annoying with these - only the ones that stopped me for over 15 mins :slight_smile:

Don’t worry about being annoying — I’d rather go through a little extra work in order to make the book experience great, get great feedback, and land work on another book (maybe even the 9th edition!).

1 Like

whatever I can do to help :slight_smile:

I want to be clear- I’m enjoying the book. The explanations are at a perfect level for me, a “recurring beginner.” I will also acknowledge that I am a perfectionist, and as such I see every error, typo or otherwise. I have not been flooding this forum with them, because as pointed out, most people probably can figure them out.

Is your stance to just leave them be? Here’s a good example: At the end of Chapter 7 the last code block image is supposed to show the selection of the VStack block. Instead, it shows the finished product, with no overt explanation of how to get there. To fix, you would need to:

  1. change the image to the code showing the VStack block selected
  2. describe the indentation method used previously (Command + ])
  3. direct to add “Group {” above VStack
  4. direct to add “}” in line after .backgroud(beige)
  5. direct to add “.background(Image(“Background”))” after that closing brace

Two paragraphs above this, “…complete with padding:” suggests an image was supposed to follow.

Will there be a future edit? Like @jamesh I will only post if something’s stumped me, but I’m curious how rigorous you plan to edit raywanderlich books.

There’s also something very strange going on on page 253. Seems to be missing some text in one of the grey boxes:

pic

Here’s another one: The photo captions on page 285 to 287 are wrong. The captions describe the Checklist app, which is not the app in the photos.

Page 321, typo:

Now, make use of oveListItem in .onMove.

Page 381: Nowhere does it say to replace

.onDelete(perform: deleteListItem)
.onMove(perform: moveListItem)

with

.onDelete(perform: checklist.deleteListItem)
.onMove(perform: checklist.moveListItem)

The app will not build and run until this is done.

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

Hi,
I’m not sure if this a typo or not, but when I changed it, it worked. Right now, on pg. 782, it says:

String(from: placemark)

…but later we make a function called string(from placemark:) on pg. 783.

I went back and changed the capital S in String to a lowercase s since we have a new function for it. It ran successfully. I didn’t see any mention of that in the textbook, but if I misunderstood something, please disregard. Thank you!

There’s a typo on pg. 808.
“If you were write the above code without the as! ItemDetailViewController bit, like so:”

@mdlau Thank you for sharing this - much appreciated! We will definitely fix everything in the next version of the book.

There’s an editor’s note on page 541 of the ios Apprentice book that has swift 5.1.

                    ForEach(checkListItems) { checklistItem in HStack {
                        Text( checklistItem.name)
                        Spacer()
                        Text(checklistItem.isChecked ? "☑️" : "🔲") }.onTapGesture {
                            print("checklistItem name: \(checklistItem.name}") }
                        }

.name is not being automatically presented when typing in the code. I think the source code is incorrect.