You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
func find(name:String)->Promise<Element?>{Promise{ seal infind(name: name){(result)in
switch result {case.success(let elements):
if let element = elements {
// ??? How to return the element
seal.fulfill(element)}else{
seal.fulfill(nil)}case.failure(let error):print(error)
// ??? How to return nil
seal.fulfill(nil)}}}}
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
AwaitKit
used for the case like my example?The text was updated successfully, but these errors were encountered: