[Solved] Swift: use string variable in other file [closed]


struct Globals {

    static var score: Int = 0

    // Any other global variables you want.
}

Access by:

let score = Globals.score

You can also store information in UserDefaults to persist across launches of the app.

2

solved Swift: use string variable in other file [closed]