According to my understanding, if you define a view yourself (as a struct that implements View
), then you can declare some var to be an Environment variable, like this:
@Environment(\.isEnabled) var isEnabled
This will give you access to the EnvironmentValues.isEnabled
field.
However, it seems like this is only possible within the view definition itself.
Is it possible, given some view v
, to get the environment object of that view? or get specific environment values?