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

Promises, Futures, and the Shape of Your Code

Promises, Futures, and the Shape of Your Code

Greg Heo

May 21, 2018
Tweet

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. %&