Integrate Combine Into an App

Aug 5 2021 · Swift 5.4, macOS 11.3, Xcode 12.5

Part 1: Define a View Model

05. Use @ObservedObject to Monitor State

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 04. Use Publishers in the ViewModel Next episode: Part 1 Quiz: Integrate Combine into an App

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

There’s one more thing you’ll do to the model before moving on: Make it conform to ObservableObject so that it can be observed throughout the app.

public final class JokesViewModel: ObservableObject {
@ObservedObject var viewModel: JokesViewModel
@ObservedObject private var viewModel = JokesViewModel()