From my understanding @Environment is specifically there to work with SwiftUI’s own pre-defined keys and @Environment is great for reading out things like device is in dark mode or light mode, what size class your view is being rendered with, and more – fixed properties that come from the system.
- Why we need to create custom environment values with key path system
- Under the hood some modifiers like alignment changes environment value. Why it is required to modify environment value instead of wrapper View
- If we can set by modifier why we need to inject with
.environment
modifier - Why can't we use Singleton or Global instead of environment value