Working with Observable Objects and Combine
Failure is an option here. If things are not failing, you are not innovating enough.
– Elon Musk
Previously, we added the Review screen for users to rate a restaurant. The rating buttons are not yet functional. When a rating is selected, the expected behaviour is that the review view dismisses itself and the selected rating will show up in the detail view. In this chapter, we will discuss the implementation.
On top of that, I will give you a brief introduction to Combine, which was a new framework introduced along with SwiftUI. Combine lets you easily monitor a single object and get notified of changes. Working along with SwiftUI, we can trigger an update of a view without writing a line of code. Everything is handled behind the scenes by SwiftUI and Combine.
To access the full version of the book, please get the full copy here. You will also be able to access the full source code of the project.