Skip to content

Instantly share code, notes, and snippets.

@alexpersian
Last active July 6, 2018 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexpersian/3b82ddd4d0f7be63a2f87e72d87d0210 to your computer and use it in GitHub Desktop.
Save alexpersian/3b82ddd4d0f7be63a2f87e72d87d0210 to your computer and use it in GitHub Desktop.
firstly {
// Execute all promises simultaneously
when(fulfilled: firstPromise(), secondPromise(), thirdPromise())
}.done { first, second, third in
// Once they all complete, data will be available here
let newData = [first, second, third].flatMap { return $0 }
process(newData)
}.catch { error in
print("Error: ", error.localizedDescription)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment