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

implementation_for_promise_using_nested_generics

C5fb6051a588c0b9dc308e97800098ad?s=47 hirose yudai
April 28, 2017
810

 implementation_for_promise_using_nested_generics

Swift愛好会

#18の登壇内容です

Promiseを実装して見たらこういう風に実装できるね
という流れを説明した資料になります

C5fb6051a588c0b9dc308e97800098ad?s=128

hirose yudai

April 28, 2017
Tweet

Transcript

  1. 4XJGUѪ޷ձ 4XJGU OFTUFEHFOFSJDTͰ1SPNJTFΛ࣮૷ͯ͠ΈΑ͏

  2. "HFOEB ࣗݾ঺հ લஔ͖  ޤ৯λΠϜ ຊฤ  1SPNJTF࣮૷͍͔ͯ͘͠ ͓·͚

  3. ࣗݾ঺հ ໊લኍ੉༤େ ৬छJ04&OHJOFFS Α͘ษڧձͰ͸ࣗ࡞044ʹ͍ͭͯ࿩ ͯ͠·͢ɻ໊͍ͭͨ͋ͩ͸4UBSޤ৯ Ͱ͢ɻ4UBS͍ͩ͘͞ɻ HJUIVCIUUQHJUIVCDPNCBOO[BJ

  4. ޤ৯λΠϜ IUUQTHJUIVCDPNCBOO[BJ,VSJ ,VSJ͍ͬͯ͏ϥΠϒϥϦͷWFSTJPO Λެ։ͨ͠ͷͰҰॠ͚ͩσϞ ͦͬͱελʔ͍ͩ͘͞

  5. ͦΕͰ͸͓·͚ͱͯ͠

  6. /FTUFEHFOFSJDTΛ࢖༻ͯ͠

  7. 1SPNJTF࣮૷͍͖͠·͠ΐ͏

  8. ࣮૷͢Δલʹ /FTUFEHFOFSJDTͱ͸  1SPNJTFͱ͸ʁ ஫ҙࣄ߲

  9. ࣮૷͢Δલʹ /FTUFEHFOFSJDTͱ͸  1SPNJTFͱ͸ʁ ஫ҙࣄ߲

  10. /FTUFEHFOFSJDTͱ͸ 4XJGU͔Βͷػೳ OFTUͨ͠UZQF DMBTT TUSVDU FOVN ʹ (FOFSJDTΛOFTUͯ͠ద༻Ͱ͖Δ ৄࡉ͸ͪ͜ΒIUUQT XXXIBDLJOHXJUITXJGUDPNTXJGU

  11. None
  12. ࣮૷͢Δલʹ /FTUFEHFOFSJDTͱ͸  1SPNJTFͱ͸ʁ ஫ҙࣄ߲

  13. 1SPNJTFͱ͸ʁ ฒߦॲཧɾඇಉظॲཧΛΑΓ؆୯ʹ͔͚Δ σβΠϯύλʔϯͷҰͭͰ͢ Ұͭ՝୊Λఏࣔͯͦ͠ΕΛྫʹͯ͠આ໌͠·͢ ৄࡉ͸A1SPNJTF'VUVSFAͰάά͍ͬͯͩ͘͞

  14. ղܾ͍ͨ͠՝୊ 
 
 J04ΞϓϦ։ൃͰαʔόʔͱͷ௨৴Λෳ਺ߦ ͏৔߹ʹεοΩϦॻ͖͍ͨ

  15. None
  16. None
  17. None
  18. None
  19. None
  20. None
  21. None
  22. None
  23. 1SPNJTFͰ࣮ݱ͍ͨ͜͠ͱ ՝୊ J04ΞϓϦ։ൃͰαʔόʔͱͷ௨৴Λෳ਺ߦ ͏৔߹ʹεοΩϦॻ͖͍ͨ ˠϝιουνΣΠϯͰ͔͋ͨ΋ಉظతʹ࣮ߦ ͍ͯ͠ΔΑ͏ʹॻ͘͜ͱͰՄಡੑΛ͋͛Δ

  24. 1SPNJTFͰ࣮ݱ͍ͨ͜͠ͱ ՝୊ J04ΞϓϦ։ൃͰαʔόʔͱͷ௨৴Λෳ਺ߦ ͏৔߹ʹεοΩϦॻ͖͍ͨ ˠϝιουνΣΠϯͰ͔͋ͨ΋ಉظతʹ࣮ߦ ͍ͯ͠ΔΑ͏ʹॻ͘͜ͱͰՄಡੑΛ͋͛Δ

  25. ࣮૷͢Δલʹ /FTUFEHFOFSJDTͱ͸  1SPNJTFͱ͸ʁ ஫ҙࣄ߲

  26. ஫ҙࣄ߲ 1SPNJTF -JLF ͷϥΠϒϥϦ͸৭ʑͱ͋Γ· ͢ɻ ࠓ͔Β࣮૷͢Δͷ͸؆қతͰػೳ͕গͳ͍΋ ͷΛ࣮૷͍ͯ͘͠ͷͰɺ͜ͷஊٛͰ঺հ͢Δ ͷ͸1SPNJTFͷҰ෦ͷಛ௃ͱ͍͏͜ͱΛ಄ʹ ஔ͍͓͍͍ͯͯͩ͘͞

  27. None
  28. ·ͣ͸ҰͭͷྲྀΕ͔Β

  29. ϝιουνΣΠϯΛ࣮ݱ͠Α͏

  30. ͜͏͢Ε͹Ͱ͖Δ

  31. 1SPNJTFͱ͍͏֓೦Λ௥Ճͯ͠

  32. $MPTVSFΛҾ਺ʹͱͬͯ
 1SPNJTFΛฦͤ͹

  33. ͱΓ͋͑ͣܨ͍Ͱ͔͚ͨ

  34. ͱΓ͋͑ͣܨ͍Ͱ͔͚ͨ

  35. $MPTVSFʹҾ਺͕͋Δ

  36. (FOFSJDTʹΑΓ Ҿ਺ͷܕΛܾΊΔ

  37. ࣮ࡍʹ஋Λग़ྗ͍ͨ͠

  38. ϓϩύςΟͰอ࣋ͯ͠

  39. ஋Λ౉ͯ͠$MPTVSFΛ࣮ߦ

  40. None
  41. ͔͠͠ɺ͜ͷ··ͩͱ
 Τϥʔͷ࣌΋࣮ߦͰ͖ͯ͠·͏

  42. ੒ޭͷ࣌΋౓ݺ΂Δ

  43. ͳΜ͔ࣄނΓͦ͏

  44. ͲͪΒ͔͚࣮ͩߦ͍ͨ͠

  45. Կ౓΋࣮ߦ͞Εͨ͘ͳ͍

  46. None
  47. ͱΓ͋͑ͣࠓ͕ Ͳ͏͍͏ঢ়ଶ͔͸อ͍࣋ͨ͠

  48. GN

  49. ͜ΕͰ͍͚ͦ͏

  50. ΋͏Ұݸ$MPTVSFͰแΜͰ͋͛Δ K K K

  51. SFTPMWFEͷ͚࣮࣌ͩߦ K K K

  52. ͲͪΒ͔͕࣮ߦ͞ΕͨΒ഑ྻΛফ͢ K

  53. Ұ౓࣮ߦͨ͠ޙʹશͯফͯ͠͠·͏ K

  54. ࣮ߦ

  55. Α͠

  56. ͜ΕͰ΋͍͍Μ͚ͩͲ

  57. ϦϑΝΫλϦϯά͠Α͏

  58. ͕͍͚ͯ͜͜ͳ͍ K

  59. ͦ͜Ͱ

  60. Α͏΍͓͘લͷग़൪ͩ

  61. ʊਓਓਓਓਓਓਓਓਓʊ ʼɹ/FTUFE(FOFSJDTɹʻ ʉ:?:?:?:?:?:?:?:ʉ

  62. ਌ͷ(FOFSJDTॻ͘

  63. ஋͖ͭ&OVNʹอ࣋

  64. ແཧͳ͘औΓग़ͤΔ

  65. (FOFSJD$BDIF YED DZDMJDNFUBEBUBEFQFOEFODZ EFUFDUFE BCPSUJOH

  66. ͋ͱ॥؀ࢀর͍ͯ͠ΔͷͰXFBLʹ

  67. ࣮ߦ

  68. None
  69. ࠓճ͸͜͜·Ͱ ͪΐͬͱࢿྉ࡞Δ࣌ؒ΋ஊٛͷ࣌ؒ΋଍Γͳ͔ͬͨͷͰࠓճ͸͜͜ ͰऴΘΒ͍͖ͤͯͨͩ·͢ ΩϞͷ෦෼͸આ໌ͨ͠ͷͰޙ͸ AUIFOAϝιουͱ࣮ࡍʹ63-4FTTJPOΛ࢖ͬͯͲ͏ॻ͚Δ͔Λݴ͑ ͨΒΑ͔ͬͨͳ͋ͱࢥ͍ͬͯ·͢ આ໌͢Δ༧ఆͩͬͨίʔυ͸(JU)VCʹ্͍͛ͯΔͷͰΑ͔ͬͨΒͦ ͪΒΛݟ͍ͯͩ͘͞ IUUQTHJUIVCDPNCBOO[BJ1SPNJTF%FNP

  70. ·ͱΊ OFTUFEHFOFSJDTͷ࢖͍ํͷҰྫͱͯ͠ൃද͠·ͨ͠ɻ ·ͨɺ1SPNJTFͷ಺෦తͳಈ࡞Λগ͠Ͱ΋૝૾͠΍͢ ͘ͳͬͨͷͰ͸ͳ͍Ͱ͠ΐ͏͔ ͱʹ͔͘๻ͷϦϙδτϦશ෦ʹશͯ4UBS͍ͩ͘͞ IUUQHJUIVCDPNCBOO[BJ

  71. ͓͠·͍