@EnvironmentObject Is a Branched Global Variable
In SwiftUI, @EnvironmentObject
is used to loosely couple any ObservableObject
without directly passing it down the view hierarchy, e.g. via parameter injection. Unlike Singletons and global variables, Environment Objects are local to view hierarchies: different branches in the hierarchy can maintain different object references.