Last active
July 6, 2018 02:31
-
-
Save alexpersian/3b82ddd4d0f7be63a2f87e72d87d0210 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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