I need to access an EnvironmentObject from a method within a View-Extension, so I cannot add an @EnvironmentObject property.
I tried to do it like
extension View {
func myFunc() {
let something = EnvironmentObject<MyType>()
}
}
But that doesn't work - is there another/better way to get it from within the method?
You can pass the object as a parameter: