I have a function:
func find(name: String, complete: (([Result])->Void))
I want to convert to a function something like this:
func find(name: String) -> Promise<Element?> {
find(name: name) {
(result) in
switch result {
case .success(let elements):
if let element = elements {
// ??? How to return the element
}
case .failure(let error):
print(error)
// ??? How to return nil
}
}
}
The example is really simple one. Can AwaitKit used for the case like my example?
I have a function:
func find(name: String, complete: (([Result])->Void))I want to convert to a function something like this:
The example is really simple one. Can
AwaitKitused for the case like my example?