how do I modify a value within a closure or at least get data from a closure in Swift? I have a global variable declared outside a class and I am trying to modify it from within a closure or completion block; however, it is not modified and I cannot get data from inside a closure.
var someGlobalVariable = 0
class someClass{
dispatch_async(dispatch_get_main_queue(), { () -> Void in
someGlobalVarible += 1
})
}
print(someGlobalVariable) // returns 0 and not 1
}