I'm trying to implement Completion handlers but I'm getting this error:
cannot convert value of type to specified type.
Here is my code:
override func viewDidLoad() {
super.viewDidLoad()
let sss : String = doSomethingElse { (data) in
}
print(sss)
}
func doSomethingElse(completion:(data:String) -> Void) {
let s = "blablabla"
print(s)
completion(data:s)
}
On this line is where I'm getting the error:
let sss : String = doSomethingElse { (data) in
Any of you knows why I'm getting this error?
I'll really appreciate your help.
sss
as aString
and then tried to assign a closure to it. – Paulw11