Example 1:
no input parameters, just has return like String type
func method1( completion: (result: String) -> Void) {
//some code
completion(“This is method1 result”)
}
Usage:
method1() {
(result: String) in
print(“got back: (result)”)
}
Example 2:
has input parameters, AND has return like String type
func method2(input: String, completion: (result: String) -> Void) {
//some code
completion(“This is method2 result”)
}
Usage:
method2(“input parameter value”) {
(result: String) in
print(“got back: (result)”)
}