Errata for SwiftUI Cookbook

Creating this topic to catch any typos and bugs in the SwiftUI Cookbook: SwiftUI Cookbook | Kodeco

1 Like

Section 21, chapter 9.2
@ObservedObject var viewModel = ToDoListViewModel()
Should rather be aStateObject?

“Best Practices for State Management in SwiftUI”

Many tips are missing are smushed together.

iPadOS - Safari

Thanks for bringing this to our attention. It should be fixed now. — Susannah

Thanks for catching this. I’ve corrected it now. — Susannah

In the code block for Section 3: Chapter 8: Best Practices for State Management in SwiftUI, the ContentView struct is repeated.

In chapter 2 of Tab Views & Split Views in SwiftUI, Customize Tab View Appearance in SwiftUI, “.toolbarBackground(.hidden, for: .tabBar)” for the 2nd tab is not in the source code.

Thanks for taking the time to write in and well spotted. I’ve updated this so there’s just one ContentView now. :]

1 Like

Ah, right you are. Thanks for taking the time to write in. I tested this with and without the modifier and it doesn’t seem to make a difference, but I added it into the code block since we discuss it and show it in the screencap.

Understood. Thank you for your comment on this. ||

1 Like

This chapter has the wrong description about resizable:

  • .resizable() allows the Image view to dynamically adjust its size based on the available space. It ensures that the image can be scaled up or down without losing its aspect ratio.

I think resizable do not keep the aspect ratio