Group Group Group Group Group Group Group Group Group

Errata for SwiftUI by Tutorials, 2nd ed

Chapter 10, page 284: withAnimation is used on the tap gesture, but the animation will also work if the withAnimation is removed. Seems like .animation(.spring()) is taking care of that already.

1 Like

Chapter 13, page 333: It is not clear to the reader that the Rectangle needs to be added to the FirstVisitAward file.

1 Like

Hi @pepejeria, thanks a lot for reporting this issues. Note taken, we’ll fix them!

1 Like

Hey :wave:, awesome book :+1: - very clearly written, with concepts expertly presented and explained.

I spotted a redundant fuction that can be cut in Chapter 10 - Gestures. I’m using the web version so not sure which page, but just before the “Your first gesture” section, the reader is asked to add the following helper methods to DeckView.swift:

func getCardView(for card: FlashCard) -> CardView {
  let activeCards = deck.cards.filter { $0.isActive == true }
  if let lastCard = activeCards.last {
    if lastCard == card {
      return createCardView(for: card)
    }
  }

  let view = createCardView(for: card)

  return view
}

func createCardView(for card: FlashCard) -> CardView {    
  let view = CardView(card)

  return view
}

The getCardView effectively forwards the same card parameter on to createCardView regardless of the path taken in getCardView (ie whether the card matches the last card in an activeCards array or not). Perhaps this is a remnant of an earlier version where the filtering for active cards was done in this helper function?

Later on in the chapter the reader is asked to add the following (to body of DeckView.swift):

ForEach(deck.cards.filter { $0.isActive }) { card in
	self.getCardView(for: card)
}

As this already filters the deck for active cards, the call inside ForEach can be replaced with self.createCardView(for: card), removing the need for getCardView function.

Book Swift UI by Tutorials; app RGBullsEye, first chapter, when creating a Swift App with interface Switf UI in Xcode the files don’t at all correspond to the description in the book, e.g. AppDelegate.swift and SceneDelegate.swift are not present? The only Swift files present is RGBullsEyeApp.swift and ContentView.swift?

hi Fredrik, sorry I didn’t see this until now.

The current Xcode replaced AppDelegate and SceneDelegate with the App file. That’s where the app loads ContentView as the first scene.

Any idea on when the book will be updated?

hi Elio! soon … paging @mandafrederick

@phantom59 @tomcondon @elio.d Please check out the highlights of the updated version of the book over here when you get a chance:

I hope it helps!

1 Like