[Solved] Variables across all view controllers [closed]

[ad_1]

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

[ad_2]

solved Variables across all view controllers [closed]