Building a complete project with SwiftUI

Overview

This LARGE lesson comes from Hacking with Swift (hackingwithswift.com). The person who produces these tutorials seems to have inside connections at Apple because his tutorials came out, it seemed like, seconds after Swiftui was announced last spring. The Hacking tutorials have lots of useful information and are one of the better resources I have found at this point. This particular lesson covers a LOT, but I think that most of you will like and benefit from it.

If you find yourself feeling overwhelmed by new concepts and jargon at some point, just plow through and keep on working. As I write this, I am going through the Observable objects, environment objects, and @Published section of the tutorial, and still am a bit puzzled by his explanation (and application) of ObservableObject. But it works, even though I’m not 100% clear on why and how it works.

My advice is to enjoy this lesson and give it your best effort. Even if you don’t yet understand everything, it can serve as a great source of code and concepts for future projects if you give it enough effort.

Key Takeaways

  • ObservableObject is a class-based model that broadcasts changes to any view that observes it.
  • @Published marks a property so that any change automatically notifies subscribed views and triggers a re-render.
  • @EnvironmentObject injects a shared model instance into an entire view hierarchy without manually passing it through every layer.
  • This pattern — separating Model from View using ObservableObject — is the foundation of scalable, real-world SwiftUI apps.
  • If certain concepts feel confusing mid-tutorial, keep going — the full picture often makes individual pieces click retroactively.