Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support async/await #11

Merged
merged 5 commits into from Jul 11, 2022
Merged

Support async/await #11

merged 5 commits into from Jul 11, 2022

Conversation

AndrewBarba
Copy link
Owner

@AndrewBarba AndrewBarba commented Jun 8, 2021

  • Supports async/await in Swift 5.5 via a new value() async method on the promise
  • Initialize a Promise with an async handler

Async Value

let user = await getUser().value()

Async Init

let promise = Promise<User> {
    return await getUserAsync()
}

Async chain

getUser()
    .then { await getFavorites(for: $0) }

@AndrewBarba AndrewBarba merged commit 139defb into master Jul 11, 2022
@AndrewBarba AndrewBarba deleted the swift-5.5 branch July 11, 2022 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant