Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Created June 14, 2020 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencurtis/60020d823085de81b9e2ddde0986f180 to your computer and use it in GitHub Desktop.
Save stevencurtis/60020d823085de81b9e2ddde0986f180 to your computer and use it in GitHub Desktop.
addmathescaping
let add: (Int,Int) -> () = { a, b in
print("Result \(a + b)")
}
func mathForOneAndTwo(firstNum: Int, secondNum: Int, action: @escaping (Int,Int) -> Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {
action(firstNum,secondNum)
} )
}
mathForOneAndTwo(firstNum: 1, secondNum: 2, action: add)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment