Group Group Group Group Group Group Group Group Group

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…

1 Like

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: