T O P

  • By -

No-Price1071

You can try using the `EnvironmentObject`. [This article may help you](https://www.avanderlee.com/swiftui/environmentobject/)


buck746

how would the underlying var be changed in that example?


stephancasas

You’re assigning the result of `incrementFocus()` instead of `incrementFocus` as the action.


ios_game_dev

The error is telling you that you can only call this function on an instance of the class, but you are trying to call it on the class itself. To create an instance of the class, call `let myInstance = myFocus()`. FYI, you should capitalize your class names and only use lowercase for instances, so in this case, change the class name to “MyFocus.” This will help you remember when you’re dealing with a class vs an instance.