Promises, Futures, and the Shape of Your Code

Promises, Futures, and the Shape of Your Code

06609d73ad2165c4aafcf65a1ddb9563?s=128

Greg Heo

May 21, 2018
Tweet

Transcript

  1. 3.
  2. 4.
  3. 5.
  4. 6.
  5. 7.
  6. 8.

    !

  7. 12.
  8. 13.

    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")
  9. 14.
  10. 15.
  11. 17.

    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")
  12. 18.
  13. 19.

    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!") } } } })
  14. 20.
  15. 21.
  16. 28.
  17. 29.
  18. 32.
  19. 33.

  20. 34.

    %&