Christian Tietze

  • Posts
  • Books
  • Apps
  • Work With Me
  • Contact

@EnvironmentObject Is a Branched Global Variable

May 14th, 2022

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.

Continue reading …

  • ∞ Permalink
  • • Comments
  • • Tags:
    • swiftui
    • binding

Contact • Newsletter • blog post feed
Become an affiliate • Legal Information • Twitter

Except where otherwise noted, content on this site is licensed CC BY-SA 4.0.