Global variables

Use structures as global variables
struct MyVariables {
    static var yourVariable = "someString"
}

let string = MyVariables.yourVariable
println("Global variable:\(string)")

//Changing value of it
MyVariables.yourVariable = "anotherString"

Comments

Popular posts from this blog

Setting up a playground

Go to another page