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

RxSwift in Practice

4239ea2bf38d7178476faa8787683105?s=47 Motoki Narita
November 20, 2016

RxSwift in Practice

4239ea2bf38d7178476faa8787683105?s=128

Motoki Narita

November 20, 2016
Tweet

Transcript

  1. 3Y4XJGUJO1SBDUJDF J04Φʔϧελʔζ .PUPLJ/BSJUB !NPUPLJFF

  2. ࣗݾ঺հ w !NPUPLJFF w J04ΤϯδχΞ w ϝϧΧϦΞοςͷJ04Λ։ൃ w ωΫετʢ)0.&`4ʣˠι΢κ΢ʢ೥݄ʣ w

    ݸਓͰ΋झຯͰJ04ΞϓϦΛ։ൃ w J04%$+BQBOίΞελοϑ
  3. 3Y4XJGU࢖͍ͬͯ·͔͢

  4. ϝϧΧϦΞος͸શ໘తʹ 3Y4XJGUΛ࠾༻ͯ͠։ൃ

  5. Ξος։ൃͷٕज़ɿ4XJGUͱ3Y4XJGUCZ4IJOJDIJSP0CB IUUQTTQFBLFSEFDLDPNCSJDLMJGFBUVUFLBJGBGBMTFKJTIVTXJGUUPSYTXJGU

  6. ͍͍ͩͨ4XJGUͰॻ͔Ε͍ͯΔ ˞0CKFDUJWF$͸ϥΠϒϥϦͳͲ

  7. ൒೥લʜ

  8. ձࣾʢલ৬ʣͰ3Y4XJGUษڧձ w ౰࣌ͳΜͱͳ͘ྲྀߦ͍ͬͯͨ w ࣾ಺ͷ༗ࢤͰʢۀ຿֎ʣ w ຖि݄༵ேʢʙʣʹू·ͬͯษڧձ w 1MBZHSPVOEͰجຊతͳΦϖϨʔλΛֶͿ w

    &YBNQMFTΛݟΔ
  9. ճ͘Β͍΍ͬͯΈͨײ૝ w ࣮ફతͳίʔυΛॻ͍ͯਐΊͨํ͕ྑͦ͞͏ w ந৅౓͕ߴ͘ɺͳΜͷͨΊʹ3Y4XJGUΛ࢖͏ͷ͔ɺԿ͕ྑ ͘ͳΔͷ͔ɺཧղͰ͖͍ͯͳ͔ͬͨ w ϝϯόʔʹ΋ཧղͯ͠໯͏ඞཁ͕͋Γͦ͏

  10. ʮผʹಋೖ͠ͳͯ͘΋͍͍͔ʯ ͱࢥͬͨ൒೥ޙʜ

  11. స৬ͯ͠3Y4XJGUΛϑϧͰ࢖͏͜ͱʹ

  12. ຊ֨తʹ3Y4XJGUͰ։ൃΛ࢝Ίͯϲ݄ͷ φϚͷ੠Λ͓ಧ͚͠·͢

  13. 3Y4XJGUʹ͍ͭͯ

  14. 3Y4XJGU w ϦΞΫςΟϒϓϩάϥϛϯάΛ4XJGUͰॻͨ͘Ίͷ
 ϥΠϒϥϦ w ϚΠΫϩιϑτ͕/&5'SBNFXPSLʹ޲͚ʹ
 ϦϦʔεͨ͠3FBDUJWF&YUFOTJPOTʢ3YʣϥΠϒϥϦ Ͱ͋Δ3Y/&5 Ҿ༻IUUQXXXCVJMEJOTJEFSOFUDPMVNOLBXBJZPTIJGVNJ ͔Β೿ੜ

    w 4XJGUҎ֎ʹ΋3Y+BWBɺ3Y+4ͳͲͷ༷ʑͳݴޠʹ
 ೿ੜ
  15. Ξος։ൃͷٕज़ɿ4XJGUͱ3Y4XJGUCZ4IJOJDIJSP0CB IUUQTTQFBLFSEFDLDPNCSJDLMJGFBUVUFLBJGBGBMTFKJTIVTXJGUUPSYTXJGU

  16. ετϦʔϜ઒

  17. None
  18. ετϦʔϜΛͲ͏ѻ͏͔ʁ ࡞ΔՃ޻؂ࢹ

  19. ;Ή;Ήɺ;Ή;Ήɻ ετϦʔϜΛ࡞ΔՃ޻͢Δ؂ࢹ͢Δͱ͍͏ࢹ఺Ͱ ϓϩάϥϛϯάΛߦ͏ͱɻ

  20. ͳΔ΄ͲɺͳΔ΄Ͳɻ ετϦʔϜΛ࡞ΔՃ޻͢Δ؂ࢹ͢Δͱ͍͏ࢹ఺Ͱ ϓϩάϥϛϯάΛߦ͏ɻͳΔ΄ͲͰ͢Ͷʙɻ

  21. ͳΔ΄Ͳɺ·ͬͨ͘Θ͔ΒΜ

  22. Ͳ͏͍͏͜ͱʁ w ετϦʔϜΛ࡞Δʁ w ετϦʔϜΛՃ޻͢Δʁ w ετϦʔϜΛ؂ࢹ͢Δʁ

  23. ݱ৔ͰͲͷΑ͏ʹ࢖͍ͬͯΔͷ͔ʁ ઃܭʹͲͷΑ͏ʹӨڹΛ༩͍͑ͯΔͷ͔ʁ

  24. ͍·͋ΔॲཧΛͲͷΑ͏ʹ ॻ͖׵͑ΒΕΔͷ͔ʁ

  25. ࣮ࡍʹϦϦʔε͞Ε͍ͯΔɺ ͋ΔΧϝϥΞϓϦͷ࣮૷Λ3Yʹॻ͖׵͑ͯΈΔ

  26. ͋ΔΧϝϥΞϓϦʹ͍ͭͯ w ڈ೥࡞ͬͨࣗ෼ͷΞϓϦ w Χϝϥ͔Βͷೖྗө૾ʹϑΟϧλʔΛ͔͚ͯϦΞϧ λΠϜͰϓϨϏϡʔͰ͖Δ w ࡱӨ͢ΔͱϑΟϧλʔՃ޻͞Εͨঢ়ଶͷը૾͕อଘ ͞ΕΔ

  27. None
  28. Ϙλϯλοϓ ϩʔσΟϯάදࣔɺ
 ɹը૾ΛΩϟϓνϟɺอଘ͢Δ ը૾อଘޙɺϩʔσΟϯάΛ
 ɹඇදࣔʹͯ͠ϑΟϧλʔΛมߋ

  29. ௨ৗͷ࣮૷  Ϙλϯ͕ԡ͞ΕͨࡍʹҎԼͷ ॲཧΛߦ͏ϝιου࡞Δ  ը૾ΛΩϟϓνϟͯ͠อଘ͢Δ  ͕ऴྃͨ͠ΒϩʔσΟϯάඇ දࣔ 

    ͱಉ࣌ʹϑΟϧλʔΛมߋ  Ϙλϯλοϓ  Ϙλϯλοϓޙɺ
 ը૾ΛΩϟϓνϟɺอଘ͢Δ  ը૾Λอଘ͞ΕΔ·Ͱ
 ϩʔσΟϯάදࣔ  ը૾อଘޙʹ
 ϑΟϧλʔΛมߋ
  30. ࣮ࡍͷίʔυ Λ ͔ͳΓϚγʹͨ͠΋ͷ

  31. Ϙλϯ͕ԡ͞ΕͨΒϩʔσΟϯάදࣔ ࣮ࡍͷίʔυ Λ ͔ͳΓϚγʹͨ͠΋ͷ

  32. Ωϟϓνϟ ࣮ࡍͷίʔυ Λ ͔ͳΓϚγʹͨ͠΋ͷ

  33. ࣮ࡍͷίʔυ Λ ͔ͳΓϚγʹͨ͠΋ͷ Ωϟϓνϟऴྃޙɺ੒ޭͰ͋Ε͹ϩʔσΟϯάඇදࣔɺΤϑΣΫτΛมߋ

  34. ࣮ࡍͷίʔυ Λ ͔ͳΓϚγʹͨ͠΋ͷ ΩϟϓνϟͰ͖ͳ͔ͬͨ৔߹͸Τϥʔදࣔ

  35. ௨ৗͷ࣮૷  Ϙλϯλοϓ  Ϙλϯλοϓޙɺ
 ը૾ΛΩϟϓνϟɺอଘ͢Δ  ը૾Λอଘ͞ΕΔ·Ͱ
 ϩʔσΟϯάදࣔ 

    ը૾อଘޙʹ
 ϑΟϧλʔΛมߋ  Ϙλϯ͕ԡ͞ΕͨࡍʹҎԼͷ ॲཧΛߦ͏ϝιου࡞Δ  ը૾ΛΩϟϓνϟͯ͠อଘ͢Δ  ͕ऴྃͨ͠ΒϩʔσΟϯάඇ දࣔ  ͱಉ࣌ʹϑΟϧλʔΛมߋ
  36. ετϦʔϜͰߟ͑Δ

  37. None
  38. ετϦʔϜͰߟ͑ͯΈΔ  Ϙλϯλοϓ  Ϙλϯλοϓޙɺ
 ը૾ΛΩϟϓνϟɺอଘ͢Δ  ը૾Λอଘ͞ΕΔ·Ͱ
 ϩʔσΟϯάදࣔ 

    ը૾อଘޙʹ
 ϑΟϧλʔΛมߋ
  39. Ϙλϯλοϓ ϩʔσΟϯάදࣔɺ
 ɹը૾ΛΩϟϓνϟɺอଘ͢Δ ը૾อଘޙɺϩʔσΟϯάΛ
 ɹඇදࣔʹͯ͠ϑΟϧλʔΛมߋ

  40. ετϦʔϜͰߟ͑ͯΈΔ Ϙλϯͷλοϓ͕ΠϕϯτͷτϦΨʔʹͳΔ  Ϙλϯλοϓ  Ϙλϯλοϓޙɺ
 ը૾ΛΩϟϓνϟɺอଘ͢Δ  ը૾Λอଘ͞ΕΔ·Ͱ
 ϩʔσΟϯάදࣔ

     ը૾อଘޙʹ
 ϑΟϧλʔΛมߋ
  41.  Ϙλϯλοϓ  Ϙλϯλοϓޙɺ
 ը૾ΛΩϟϓνϟɺอଘ͢Δ  ը૾Λอଘ͞ΕΔ·Ͱ
 ϩʔσΟϯάදࣔ  ը૾อଘޙʹ


    ϑΟϧλʔΛมߋ ετϦʔϜͰߟ͑ͯΈΔ ը૾Ωϟϓνϟͷঢ়ଶભҠ
  42. ετϦʔϜͰߟ͑ͯΈΔ ը૾ͷΩϟϓνϟঢ়ଶͷ
 ετϦʔϜ  Ϙλϯλοϓ  Ϙλϯλοϓޙɺ
 ը૾ΛΩϟϓνϟɺอଘ͢Δ  ը૾Λอଘ͞ΕΔ·Ͱ


    ϩʔσΟϯάදࣔ  ը૾อଘޙʹ
 ϑΟϧλʔΛมߋ
  43. ετϦʔϜͰߟ͑ͯΈΔ ը૾ͷΩϟϓνϟঢ়ଶͷ
 ετϦʔϜ  Ϙλϯλοϓ  Ϙλϯλοϓޙɺ
 ը૾ΛΩϟϓνϟɺอଘ͢Δ  ը૾Λอଘ͞ΕΔ·Ͱ


    ϩʔσΟϯάදࣔ  ը૾อଘޙʹ
 ϑΟϧλʔΛมߋ
  44. ίʔυ

  45. ίʔυ ϘλϯͷετϦʔϜΛը૾อଘετϦʔϜʹม׵

  46. Ϙλϯλοϓ 7PJE qBU.BQϘλϯλοϓˠը૾ͷΩϟϓνϟঢ়ଶʢ(16*NBHF4UJMM$BNFSBͷ3Y֦ு͕ߦ͏ʣ Ωϟϓνϟঢ়ଶ EFGBVMU DBQUVSJOH DBQUVSFE ϘλϯλοϓΠϕϯτ͔ΒΩϟϓνϟঢ়ଶͷετϦʔϜ΁ EFGBVMU

  47. ίʔυ ΩϟϓνϟதͰ͋Ε͹ϩʔσΟϯάΛදࣔ

  48. NBQ\DBQUVSJOH^ Ωϟϓνϟঢ়ଶ EFGBVMU DBQUVSJOH DBQUVSFE ϩʔσΟϯάதͰ͋Δ͜ͱΛද͢ετϦʔϜ Ωϟϓνϟத GBMTF USVF GBMTF

    EFGBVMU GBMTF
  49. ίʔυ ΩϟϓνϟதͰ͋Ε͹ϩʔσΟϯάΛදࣔ

  50. ίʔυ Ωϟϓνϟ׬ྃޙΤϑΣΫτΛมߋ

  51. Ωϟϓνϟঢ়ଶ EFGBVMU DBQUVSJOH DBQUVSFE Ωϟϓνϟঢ়ଶͷετϦʔϜ ΤϑΣΫτΛมߋ

  52. ίʔυ

  53. ϢʔβʔͷೖྗɺมԽ͢Δঢ়ଶͳͲΛ ετϦʔϜʹྲྀ͠ɺͦͷ஋ΛͲ͏ѻ͏͔ʁ ͱ͍͏؍఺͔Βߟ͑Δ

  54. ίʔυΛൺֱ

  55. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ ࣮૷͠Α

  56. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ ϩʔσΟϯάΛ දࣔͩ

  57. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ Ωϟϓνϟ͠Α

  58. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ SFTVMUͰ෼ذͯ͠ʜ

  59. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ ύλʔϯΛ໢ཏͬͱ

  60. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ ͑ʔͬͱɺͲ͏͢Δ Μ͚ͩͬʁ

  61. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ ͋ɺͦ͏ͩɻTVDDFTTͰ ΤϑΣΫτΛม͑ΔΜͩ

  62. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ ͦΜͰɺΤϥʔදࣔͱɻ 0,ɺͰ͖ͨ

  63. ࣮ػ֬ೝ

  64. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ ͋ɺϩʔσΟϯάফͯ͠ ͳ͔ͬͨʜ

  65. ௨ৗͷίʔυͷ࣮૷࣌ͷྲྀΕ ͜ΕͰ0,

  66. Α͋͘Δ

  67. 3Y4XJGUͰͷ࣮૷࣌ͷྲྀΕ ࣮૷͠Α

  68. 3Y4XJGUͰͷ࣮૷࣌ͷྲྀΕ ϘλϯͷλοϓΛΩϟϓ νϟঢ়ଶͷετϦʔϜʹ ม׵͢Δ

  69. 3Y4XJGUͰͷ࣮૷࣌ͷྲྀΕ ϩʔσΟϯάத͚ͩͷ
 ઒Ͱ΋࡞ͬͯCJOE͢Δ͔

  70. 3Y4XJGUͰͷ࣮૷࣌ͷྲྀΕ DBQUVSFEདྷͨΒΤϑΣ ΫτΛ੾Γସ͑Δͱ

  71. 3Y4XJGUͰͷ࣮૷࣌ͷྲྀΕ Τϥʔ͕དྷͨΒΤϥʔΛ දࣔɻͰ͖ͨ

  72. ετϦʔϜʢͷ࡞੒Ճ޻؂ࢹʣʹ ϑΥʔΧε͍ͯ͠Δ

  73. ͳΜͱͳ͓͘෼͔Γ͍͚ͨͩͨͰ͠ΐ͏͔

  74. Α͠ಋೖ͠Α͏ ͱࢥͬͨํɺͪΐͬͱ଴͍ͬͯͩ͘͞

  75. ຊ౰ʹಋೖ͢Δඞཁ͸͋Γ·͔͢ʁ

  76. ಛʹ໰୊͸ͳ͍ɻΘ͟Θ͟3Yʹ͢Δඞཁ͸͋Δͷ͔ʁ

  77. 3Y͸ۜͷ஄ؙͰ͸ͳ͍

  78. ྑ͍ͱ͜Ζɺѱ͍ͱ͜Ζ
 ʢ૊৫ͱͯ͠Ͱ͸ͳ͘ݸਓͱͯ͠ͷײ૝ʣ

  79. ྑ͍ͱ͜Ζ w ίʔυ͕ಡΈ΍͍͢ w ͦΕ͕ϢʔβʔͷೖྗͰ͋ΕɺจࣈྻͰ͋Εɺඇಉ ظॲཧͰ͋ΕͳΜͰ͋ͬͯ΋ɺετϦʔϜΛͲ͏ѻ ͏͔ͱ͍͏఺ʹूத࣮ͯ͠૷͕Ͱ͖ΔΑ͏ʹͳͬͨ w ඇಉظॲཧͷ࣮૷͸ҎલΑΓ΋ָʹͳͬͨؾ͕͢Δ

  80. ѱ͍ͱ͜Ζ w ֶशίετ͕ߴ͍ w ·͖ͩΕ͍ͳ઒ετϦʔϜ͕࡞Εͳ͍ w 3Y.BSCMFTΛݟͨΓɺطଘͷιʔεΛಡΜͩΓͯ͠ଟ͘ͷ͜ͱΛֶ ΜͰ͍Δ࠷த w ϝϯόʔͷೖΕସΘΓ͕ଟ͍ͱݫͦ͠͏

    w ϑϨʔϜϫʔΫʹେ͖͘ґଘ͢Δ͜ͱʹͳΔ w Ծʹ3Y͕ϝϯςφϯε͞Εͳ͘ͳͬͨ৔߹Ͳ͏ͳΔʁ w ʢͨͩ͠3Yࣗମʹେ͖ͳܽ఺͸ͳ͍ͱࢥ͏ʣ
  81. ι΢κ΢ͰͷऔΓ૊Έ

  82. IUUQTTQFBLFSEFDLDPNCSJDLMJGFSFBDUJWFDPDPBGBMTFZVSVJTIBPKJFUPNFSVLBSJEFGBMTFIVPZPOHTIJMJ

  83. IUUQTTQFBLFSEFDLDPNCSJDLMJGFSFBDUJWFDPDPBGBMTFZVSVJTIBPKJFUPNFSVLBSJEFGBMTFIVPZPOHTIJMJ

  84. TVTIJTIPLVOJʹΑΔϨϏϡʔΞαΠϯ w ι΢κ΢Ͱ͸TVTIJTIPLVOJͱ͍͏#05͕
 ιʔεϨϏϡʔΛϥϯμϜͰΞαΠϯͯ͘͠ΕΔ w νʔϜྗͷఈ্͛

  85. ·ͱΊ w 3Y4XJGUʹΑͬͯετϦʔϜΛͲ͏ѻ͏͔ͱ͍͏؍఺͔Βઃܭɾ࣮૷ Λߦ͏Α͏ʹͳͬͨ w ঢ়ଶͷมԽʹ೰·͞Ε͍ͯΔ৔߹ɺ༗༻ͳπʔϧʹͳΔ͔΋͠Ε· ͤΜ w ۜͷ஄ؙͰ͸ͳ͍ w

    νʔϜόϥϯεɺϝϯόʔͷೖΕସΘΓͷස౓ͳͲͳͲɺ
 ֶशίετͷ؍఺͔Βߟྀ͢΂͖͜ͱ͸ଟ͍ w طଘͷίʔυ͕͋Δ৔߹͸ɺࠓ೔ݟ͖ͯͨΑ͏ʹɺطଘͷ࣮૷Λε τϦʔϜΛ؍఺ʹઃܭɾ࣮૷ͯ͠Έͯ޾ͤʹͳΕΔ͔Λ͔֬ΊͯΈ Δͱྑ͍͔΋
  86. ࢀߟࢿྉ w IUUQTTQFBLFSEFDLDPNCSJDLMJGFSFBDUJWFDPDPBGBMTFZVSVJTIBP KJFUPNFSVLBSJEFGBMTFIVPZPOHTIJMJ w IUUQTTQFBLFSEFDLDPNCSJDLMJGFBUVUFLBJGBGBMTFKJTIVTXJGU UPSYTXJGU w IUUQTTQFBLFSEFDLDPNCSJDLMJGFTXJGUEPUEFSYTXJGU SFBDULJUSFBDUJWFDPDPBXPTIJUVUFNJUB

    w IUUQTTQFBLFSEFDLDPNJTILBXBSYUFTUT w IUUQTTQFBLFSEFDLDPNJTILBXBSYTXJGUQMVTNWWN
  87. ऴΘΓ