I am trying to learn to write swift. I am very proficient MS VB, which I have been using for almost 20 years. The Book I am learning from is: SwiftUI for Masterminds. I have got to chapter 7 with no problem. The exercise I am having a problem with Listing 7-5. The error I am getting is: Thread 1: Fatal error: No Observable object of type ApplicationData found. A View.environmentObject(_:) for ApplicationData may be missing as an ancestor of this view. I have spent the last 2 days rechecking my code. The MacBook I am using was purchased in May this year, is 16 in, M4 Max chip, 128 G ram. Firstly I want to thank you for reading this post. Secondly is there a better book to learn SwiftUI. Regards Terry Harrison
This is the third time you’ve posted pretty much the same question [1]. Folks have tried to help you on your other threads, but I wanna take a step back and look at the big picture here.
It’s unlikely that other folks on the forums have access to the specific book you’re working from. Given that, quoting an exercise from that book doesn’t help because other folks can’t look that up. You have a couple of choices:
- Switch to a different tutorial, one that’s publicly available. This is what Claud31 suggested here.
- Provide more context, so that folks can understand your question without having access to that specific tutorial. This is what darkpaw suggested here.
I’m going to add a third option:
- Look for a support channel for your specific tutorial. For example, it’s not uncommon for book authors to set up a Discord channel to encourage conversation between folks who are using the book as a tutorial.
Good luck!
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] There’s a fourth copy over on Swift Forums.