Based on Xcode 7.2.1(7C1002)
If we want to do something only after a function is completed, we use completion handlers.
func foo(name :String, completion: ((result:String?) -> Void)) {
// Do something.
completion (result: "Hello, \(name)!")
}
foo("Shane") {
result in print("Got back: \(result)")
}