Instantly share code, notes, and snippets.

What would you like to do?
Promise<Int>(in: .background, { resolve, reject in
// your async code
// to settle the promise and mark it as finished you need
// to call resolve() or reject() along with the object
}).then { value in
// we get our expected Int value here
}.catch { error in
// we get the reason of failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment