is it possible to access enviromentObject variable inside the init function in a struct?
@EnvironmentObject var socketHandler: SocketHandler
init() {
print(self.socketHandler.testVar)
}
I tried like this but did not get it to work. I got this error:
Fatal error: No ObservableObject of type SocketHandler found
I have added the enviromentObject to SceneDelegate and can access the variable in my UI.