Relative Content

Tag Archive for swiftswiftuiswiftui-environment

How to manage global state in SwiftUI and persist it

Continuing learning SwiftUI (which is so much fun) I’m doubting the way I’m managing (and storing) global state in my app and storing it. There are two categories of data that I need to manage. The first is an object from a third party library, it contains the logged in state of the user and the tokens to access the API. The second is some data that will be required for almost all API requests like the chosen server, the user’s ID, and one or two other tidbits.