SwiftUI: Putting multiple BindableObjects into Environment SwiftUI: Putting multiple BindableObjects into Environment ios ios

SwiftUI: Putting multiple BindableObjects into Environment


The call to environmentObject() returns a (modified) view, therefore you can chain the calls to put multiple objects into the environment. Example:

 let rootView = ContentView()     .environmentObject(firstBindable)     .environmentObject(secondBindable)


According to the Apple Official guide I'm guessing if each view just has one environmentObject then doing that would be fine. When there happened to be more than one, I'm not sure how the object are referenced.