Do I need ObservableObject with UIKit?

Viewed 1541

I just want to ask you. Do I need ObservableObject as an inheritance in viewModel with UIKit and Combine (without SwiftUI)? I tried it without inheritance and it works. Should I use it or not?

Thanks for your responses.

1 Answers

No, you do not need it when using Combine with UIKit.


Protocols such as ObservableObject are made for SwiftUI in mind. Basically, all ObservableObject does is signal to SwiftUI which nodes in the graph have been invalidated and need to be recomputed.

Related