April 2020
Beginner
316 pages
8h 20m
English
Once we've set up our environment object, we can now declare and use our UserData class from any View we like. Let's try it out. Head on over to RecipeDetailView.swift and add the following:
@EnvironmentObject var appData: AppData
Notice that we are not initializing any data here or being forced to set this as forced or as optional. That is because we've already injected the data into our View hierarchy back in SceneDelegate.swift.
Let's try this out now. Still in RecipeDetailView.swift, make the following highlighted change ...
Read now
Unlock full access