Final conclusion of the iOS architecture

Final conclusion of the iOS architecture

DevSap勉強会 18/07/28
https://devsap.connpass.com/event/90071/

(前回)iOSアプリのアーキテクチャについて考える
https://speakerdeck.com/yusuga/iosapurifalseakitekutiyanituitekao-eru

Df8bc8c531e2c5c89c1a007db1cf79a3?s=128

Yu Sugawara

July 28, 2018
Tweet

Transcript

  1. iOSΞϓϦͷΞʔΩςΫνϟʹ͍ͭͯ ߟ͑ͯͨͲΓண͍ͨ݁࿦ DevSapษڧձ 18/07/28

  2. ੁݪ ༞ @yusuga_

  3. ਪ͠ΞʔΩςΫνϟ ReactorKit

  4. • ReactorKit͸ϦΞΫςΟϒͰ୯ํ޲ͷ ΞʔΩςΫνϟΛߏங͢ΔͨΊͷ Framework

  5. Flux + Reactive Programming

  6. iOSΞϓϦͷΞʔΩςΫ νϟʹ͍ͭͯߟ͑Δ DevSapษڧձ 17/05/20 MVC2/MVVM/ReactorKitͷൺֱ

  7. ReactorKitΛֶͿγϦʔζ ೖ໳ฤ/جૅฤ/࣮ફฤ

  8. ReactorKit Meetup Japan LT࿮Ͱൃද

  9. ReactorKit Meetup Japan Report ~࡞ऀdevxoulʹΑΔجௐߨԋͱ࣮ફLT~

  10. ReactorKitΛਪ͍ͯ͠Δཧ༝

  11. ʓʓͷਖ਼͍͠ઃܭ͸Θ͔Γ·͔͢ʁ • ʓʓ → MVC, MVVM, MVP, Clean Architecture, VIPER

    • ֶशίετ • ϩʔΧϧ/ࣾ಺ϧʔϧ͕௥Ճ͞Εɺ͞Βʹֶशίετ
  12. ΞʔΩςΫνϟΛਖ਼͘͠ ࣮૷͢Δͷ͸೉͍͠

  13. • ReactorKit͸ɺΞʔΩςΫνϟΛߏங͢ΔͨΊͷFramework • ֶशίετ͕খ͍͞ (※ RxSwiftͷཧղ͸ඞਢ) • Flux෦෼Λࣗಈߏஙͯ͘͠ΕΔͷͰίʔυྔ͕ݮΔ

  14. ReactorKit Meetup JapanͷΞϑλʔύʔςΟʹͯ • ΞʔΩςΫνϟʹڵຯ͋Δਓ͕ଟ͍ͷͰ৭ʑͳ࿩Λฉ͘ • Ωʔϫʔυͱͯ͠ɺFlux, Redux, MVVM, Clean

    Architecture • ʓʓΛϕʔεʹ˚˚ͷҰ෦औΓೖΕͯΔͱ͍͏࿩͕ଟ͔ͬͨ • ΞʔΩςΫνϟͷ֦ு͸ආ͚Δ΂͖ͩͱࢥ͍ͬͯͨ • Ή͠Ζ൚༻ΞʔΩςΫνϟΛͦͷ··ద༻͢Δํ͕ٯʹί ετ૿ʹͳΔ͜ͱ΋…ʁ
  15. ͲͷϓϩδΣΫτʹ΋ϑΟοτ͢Δ ൚༻ΞʔΩςΫνϟΛ୳͍ͯͨ͠ • ݬ૝ͩͬͨ… • ͦΜͳ΋ͷ͸ଘࡏ͠ͳ͍ • ϓϩδΣΫτͷن໛͕খ͚͞Ε͹ͳΜͰ΋Α͘ɺن໛͕େ͖͚ Ε͹ແཧʹ߹ΘͤΔඞཁ͸ͳ͍ •

    νʔϜʢ࣮૷ऀʣͷ޷ΈͰ͋ͬͨΓɺઃܭࢥ૝ʹࠨӈ͞ΕΔ
  16. ݁࿦

  17. ൚༻తͳΞʔΩςΫνϟ͸͋͘·Ͱ΋ϕʔεͰ ඞཁͰ͋Ε͹ϓϩδΣΫτʹϚον͢ΔΑ͏ ΞʔΩςΫνϟΛ֦ு͢Δ

  18. ཱྀͷऴᖼ • ΞʔΩςΫνϟΛ୳ཱྀ͢͸ऴΘΓ • ݸਓతʹ͸ReactorKitΛϕʔεʹ͍ͯ͘͠ • ίʔυྔ͕ݮΓɺ؆୯ʹਖ਼͍͠ΞʔΩςΫνϟ͕ߏஙͰ͖Δ • ࠓͷॴࠔͬͨ͜ͱ͸ͳ͘ɺಠ֦ࣗு΋ඞཁͱ͍ͯ͠ͳ͍ •

    ԿΑΓઃܭࢥ૝͕޷͖
  19. ʢଓʣReactorKit Meetup JapanͷΞϑλʔύʔςΟʹͯ • ৭ʑͳ࿩Λฉ͍ͯͯɺͳͥ൚༻తͳΞʔΩςΫνϟ͕ϑΟοτ ͠ͳ͘ͳͬͯ͘ΔΜͩΖ͏ͱٙ໰ • ߏ଄ͷෳࡶԽ • Ұ෦ίϯϙʔωϯτͷංେԽ

    • ίϯϙʔωϯτؒͷґଘؔ܎
  20. ࣍ͷཱྀ • Dependency Injection (DI) • ґଘΦϒδΣΫτͷ஫ೖ • ࠓ·Ͱ͸SwinjectΛService૚ʹରͯ͠࠾༻͍ͯͨ͘͠Β͍

  21. ൺֱ • DIͳ͠ • DI: खಈ, Pure • ಈతDIίϯςφ: Swinject,

    Cleanse • ੩తDIίϯςφ: DIKit, Cake pattern, Reader Monad • Service Locator ύλʔϯ • Dependency Lookup
  22. ࠷༗ྗਪ͠DI Pure

  23. Pure DI • Pure DI by Mark Seemann • DIίϯςφΛ࢖༻͠ͳ͍DI

    • ݸਓతʹ͸ಈతDIίϯςφ͸ڧ͍੩త ܕ෇͚Ͱ͋ΔSwiftʹϚον͠ͳ͍ͷͰ ͸ͱײ͡Δ ! • ίʔυྔ͸ݮָͬͯͳͷͰ͕͢…
  24. Pure DI in Swift • devxoul/Pure • ࡞ऀ͸ReactorKitͱಉ͡ʂʂ • v1.0.0

    • ϥΠϒϥϦࣗମ͸ඇৗʹܰྔ • ׆༻͢ΔͨΊʹ͸DIͷ஌͕ࣝඞཁ • ReactorKitʹҾ͖ଓ͖ઃܭࢥ૝͕޷ ͖ • ݱࡏ࣮Ҋ݅ʹ࠾༻͠ઈࢍࢼߦࡨޡத
  25. Pureͷ։ൃཧ༝Λฉ͍ͯΈͨ • ReactorKitͷαϯϓϧͷ1ͭͰ͋ΔDrrribleͷ࠷৽͸Swinject͕࡟ আ͞ΕɺPureΛ࢖Θͳ͍Pure DIͷ࣮૷ʹͳ͍ͬͯΔ • ͦͷཧ༝ΛReactorKit Meetup JapanͷΞϑλʔύʔςΟͰ࡞ऀ ͷಉ྅ͷํʹ࣭໰ͨ͠

    • ಈతDIίϯςφͷ࣮૷ϛε͸ϥϯλΠϜͰ͔͠ݕ஌Ͱ͖ͳ͍ ͷΛ໰୊ʹײ͔ͨ͡Β • ࣮૷ϛε͸ίϯύΠϧͷ࣌఺Ͱݕ஌ɾղܾ͍ͨ͠
  26. DIͷཱྀ΁

  27. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ