Christian Tietze

  • Blog Posts
  • Writing
  • 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 Feed • /feeds • /now • /uses • @ctietze@mastodon.social • Privacy & Legal Information

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

As an Amazon Associate I earn from qualifying purchases. This e.g. applies to links to Amazon.com.