Data Sharing with Combine and Environment Objects
In the previous chapter, you learned how to lay out a form using the Form component. However, the form is not functional yet. No matter what options you select, the list view doesn't change to reflect the user's preference. This is what we're going to discuss and implement in this chapter. We will continue to develop the setting screen and make the app fully functional by updating the restaurant list in reference to the user's personal preference.
Specifically, there are a few topics we will discuss in later sections:
- How to use enum to better organize our code
- How to store the user's preference permanently using UserDefaults
- How to share data using Combine and @EnvironmentObject
To access the full content and the complete source code, please get your copy at https://www.appcoda.com/swiftui.