Chapter 7 should be improved

Hi. I’m a long-time RayWenderlich reader and I have read many of their books and tutorials since 2011, which is when I got into iOS development. The content is usually pretty high quality, so I’d like to voice my concerns regarding Chapter 7 of SwiftUI by Tutorials.

My intention is not to attack the book in any way. Up to Chapter 6 it is very good (despite some flaws that I will point out in the Errata at a later time), but it kind of breaks on Chapter 7. My intention with this thread is to mention the flaws on Chapter 7 of the book and to offer a way to fix them.

In short, this chapter is not really well done. It is extremely “wordy”, and the way it handles the examples is not good to learn the contents of the chapter. In the previous chapter (Chapter 6), we started the “Kuchi” app and all we wrote was the welcome screen. In Chapter 7 we suddenly have a much bigger Kuchi app provided by the started project with a bunch of code already written for us. While I am used to this format from previous books, I feel that the way Chapter 7 handled it is too much. Starter projects should only have small improvements based on the finished products from the finished project in a previous chapter, and not offer a full-fledged app built on top of the technology the book trying to teach us.

The chapter makes you open and modify a bunch of files in the starter project, but it’s hard to learn anything because you never wrote any of the original code. While the book tries to explain you why using a property wrapper over another one may be better for a use case, it’s never going to stick with you unless you can see the benefits and understand the purpose of the original code to begin with.

The way Chapter 7 is written right now feels like it’s in a very weird position in which it’s both very long and extremely short at the same time. It’s in a state in which it tries to teach you something, cramming everything it can into a single chapter, but along the way it feels like it’s omitting important details, the little code it provides and asks you to modify doesn’t have much context to understand what’s actually happening and how it compares to the original code.

Data flow in SwiftUI is extremely important to have Chapter 7 in the current state it is in.

My proposed solution is to dedicate an entire section to JUST data flow, and to keep building the “Kuchi” app step by step throughout 4 or 5 chapters in that section. The section could have a dedicated chapter for each property wrapper related to data flow. A chapter for @State, a chapter for @ObservedObject, a chapter for @EnvironmentObject, and so on. In each chapter we would build components of the app using the involved property wrapper, and as we work throughout the section, we would modify existing code to use other property wrappers when relevant. This way, we will be building the Kuchi app, and the content we will learn will stick with us for longer. We will also understand why a given property wrapper is better over another one when the time comes for a given case scenario.

Once again, my intention is not to attack the book in any way. I really like RW books and tutorials, and I really want SwiftUI By Tutorials to be on the same level as the other RW content I’ve read. SwiftUI and Combine are two technologies I was particularly excited for this year, so I bought the Fall bundle that included both as soon as it was announced.

I’m sorry if this is not the right place to say this. I will happily post it elsewhere if that’s the case.

3 Likes

I wholeheartedly agree. This is one of the reasons I’m so leery of Ray Wenderlich books (despite having many of them) is because they add too much all at once instead of focusing on the core concept then expanding. I’m running into this with the Combine book as we speak.

Same here. Chapter 7 really confused me.

thanks Andy, @chrono1081 and @lvandal! There are similar posts in Errata and another thread. Antonio responded in Inconsistent transition from chapter 6 to chapter 7 - #4 by jeden

1 Like

:sunglasses: nevilator
I found chapter 7 very difficult to follow and fully concur with Andy’s comments.

1 Like

Same here. Actually, I did some demo and searched these kinds of stuff before reading this. After reading it, but still got confused.

This is the fifth book that I have purchased here. Unfortunately, it has a lot of mistakes and at least one typo.

For example, it says “The, move the frame down…” at Page 310. Chapter 4 and Chapter 10 have some mistakes as well.

Chapter 7 is confusing because they already talked about state in Chapter 2. And they tell you to go back to RegisterView.swift without explaining what this sample project is all about.

The 2nd edition is available. We fixed many things especially chapter 7.

1 Like

Thanks. Interestingly, Chapter 7 is totally different. And it is 38 pages long.

1 Like

different author: Antonio worked really hard on it!

Actually, the old Chapter 7 has moved to Chapter 9. The new Chapter 7 is the old Chapter 8. The new Chapter 9 has a different author, though. Although the title (State & Data Flow) is the same, this chapter seems to be completely rewritten.

I’ve caught an error in Chapter 9. It says “Create a new SwiftUI file in the Practice group and name it ScoreView.swift” at the end of Page 227. The Xcode project doesn’t have ScoreView.swift. But you can’t create it because you have already included this file in the Practice folder.

Additionally, it says “In Xcode, resume the preview. This is what you should see” at Page 228. No, you won’t be able to preview it unless you work on ScoreView_Previews: PreviewProvider.

Moreover, the ScoreView.swift file included in the Practice folder imports Combine for no reason.

Audrey is right, the old chapter 7 has been completely rewritten (although the title is the same, as the topic hasn’t changed), and moved 2 chapters down.

Thanks @king9671152 for the errors, I’ll make sure they will be fixed in the next release

Thank you! I will check it out.

I’m doing Chapter 7 of Edition 2. I concur with the comments.

The author makes us modify and add too much code before we initState the _appRouter, use it in the Fooderlich Builder and remove the splash screen. My code threw an exception at that time because “The Navigator.pages must not be empty to use the Navigator.pages API” and it’s a bit hard for a newbie to understand this sibylline sentence, go through all the added code to debug.

This being said, we learn much more through a bug than if the code went through without a hitch :slight_smile:

I retract what I wrote last week that “I concur with the comments.”: Chapter 7 should be improved - #15 by kvutien

I was stuck on an exception raised in Chapter 7, Edition 2 by Vincent Ngo. My workflow is that I always run the code at the end of each section before progressing further. And I hit an exception raised at the en of the section “Using you app router”. I spent 2 days trying to find the bug I might have made when following the instructions. I was pissed off because I didn’t find many resources to help.

After 2 days, I haven’t found out why so I decided to continue the lesson. Then SURPRISE: the first sentence of the following section was that it’s normal that I raised an exception, and the following text will should how to solve the bug.

Now I’ve completed lesson 7 and I find it relatively well done. My workflow is not the same as the author’s but it’s OK. At least I learned more about Flutter when debugging by myself.

Hi, I suspect that your posts are not about SwiftUI by Tutorials - at a first glance I’d say it’s Flutter Apprentice instead…

Oops. Thousands of excuses.

I was too focused on what I’m learning :slight_smile:

Best