Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Promises, Futures, and the Shape of Your Code

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

Promises, Futures, and the Shape of Your Code

Avatar for Greg Heo

Greg Heo

May 21, 2018

More Decks by Greg Heo

Other Decks in Technology

Transcript

  1. !

  2. networker.beginRequest(.read, success: { data in
 parser.parseRaw(data) { result in
 archiver.materialize(from:

    result) { objects in
 dataStore.save(objects) { status in
 print("Save success!") } } } }) print("Hello 1")
 print("Hello 2")
  3. networker.beginRequest(.read, success: { data in
 parser.parseRaw(data) { result in
 archiver.materialize(from:

    result) { objects in
 dataStore.save(objects) { status in
 print("Save success!") } } } }) print("Hello 1")
 print("Hello 2")
  4. networker.beginRequest(.read, success: { data in
 parser.parseRaw(data) { result in
 archiver.materialize(from:

    result) { objects in
 dataStore.save(objects) { status in
 print("Save success!") } } } })
  5. ❓

  6. %&