Replies: 2 comments
|
|
0 replies
|
Probs need to specify return type too: firstly {
Promise.value(1)
}.then { _ in
Promise.value(2)
}.then { value -> Promise<Int> in
if value > 0 {
return Promise.value(3)
} else {
return Promise.value(4)
}
}.done {
print($0)
} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is the below code possible? I am getting Error. Type '()' cannot conform to 'Thenable'; only struct/enum/class types can conform to protocols.
How do I achieve condition chaining inside then closure?
All reactions