I am relatively new to the Swift language and need help understanding global variables and how to use them.
I am building an application which involves using several Views. I have a few variables which will need to seen in all Views, so I have created a Sift File called Global.
Putting aside global variables for a moment; you really do not want to be storing user credentials like that in an app. For security reasons. Some best practices are putting them in the user's keychain.
As for global variables; they need to be treated with caution. Shared mutable state is the cause of many bugs in applications.
Look up @EnviromentObject and @Enviroment for how to share common logic across views in SwiftUI,