[Solved] Variables across all view controllers [closed]


One way to do this is creating a new Swift Files, and make a struct with static variables like this:

struct CommonValues {
    static var UserNum: Int = 0
}

And then, you modify it in any view controller if you need it.

You maybe should save it and load it as well, I recommend UserDefaults for that.

4

solved Variables across all view controllers [closed]