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

TCAでのClient/Managerの 利用パターンでは副作用のActionやErrorを分離できる

7d1521d950d9bc5697868830cb04ff2f?s=47 yimajo
November 22, 2020

TCAでのClient/Managerの 利用パターンでは副作用のActionやErrorを分離できる

iOSアプリ開発のためのFunctional Architecture情報共有会2 の発表資料です。
https://connpass.com/event/194239/

7d1521d950d9bc5697868830cb04ff2f?s=128

yimajo

November 22, 2020
Tweet

Transcript

  1. TCAͰͷClient/Managerͷ ར༻ύλʔϯͰ͸෭࡞༻ͷ Action΍ErrorΛ෼཭Ͱ͖Δ iOSΞϓϦ։ൃͷͨΊͷFunctional Architecture৘ใڞ༗ձ2 @yimajo 2020/11/22 #fa_ios

  2. The Composable Architecture ʹ͸ ಛఆͷ෭࡞༻Λ·ͱΊΔΧελϜͳ Client/Managerܕͷαϯϓϧ͕͋Δ

  3. • DownloadClient • WebSocketClient • LocalSearchClient • WeatherClient • SpeechClient

    • AuthenticationClient • AudioPlayerClient • AudioRecorderClient • MotionManager • LocationManager
  4. State Action View Store DI Environment Client Effect Reducer Error

    "DUJPO
  5. State Action View Store DI Environment Client Effect Reducer Error

    "DUJPO
  6. State Action View Store DI Environment Client Effect Reducer Error

    "DUJPO
  7. State Action View Store DI Environment Client Effect Reducer Error

    "DUJPO
  8. State Action View Store DI Environment Client Effect Reducer Error

    "DUJPO
  9. State Action View Store DI Environment Client Effect Reducer Error

    "DUJPO
  10. State Action View Store DI Environment Client Effect Reducer Error

    "DUJPO
  11. Clientͷߏ੒

  12. ෭࡞༻࣮ߦΫϩʔδϟ ઐ༻ͷΤϥʔ ઐ༻ͷ"DUJPO

  13. $MJFOUͷ࣮ߦΛอ࣋͢Δ %FQFOEFODJFT

  14. TUBUJDMFUMJWFͰγϯάϧτϯతͳΠϯλϑΣʔε ෭࡞༻࣮ߦΫϩʔδϟDBODFMͷఆٛ ෭࡞༻࣮ߦΫϩʔδϟEPXOMPBEͷఆٛ

  15. MJWFͷݺͼग़͠͸&OWJSPONFOUͰ lMJWFzͷݴ༿ͷҙຯ͸Α͘Θ͔Βͳ͍ QSFWJFXʹ΋MJWF͸࢖͏ͷͰຊ൪༻ͬͯҙຯͰͳ͍ MJWF/VNCFS'BDU GPS ͳͲ͸୯ʹ௨৴͢Δ͚ͩɻ ؂ࢹͳͲΛ͍ͯ͠ΔΘ͚Ͱ΋ͳ͍ɻ GBWPSJUF JEJT'BWPSJUF ΋BTZOD"GUFSͳͷͰඇಉظॲཧ

  16. Clientͷ෭࡞༻࣮ߦΫϩʔδϟͷ ݺͼग़͠

  17. ෭࡞༻࣮ߦΫϩʔδϟEPXOMPBEͷ࣮ߦ

  18. ཧ۶ͱͯ͠ɺ$PSF.PUJPOͷ TUBSU%FWJDF.PUJPO6QEBUFT VTJOH UP  ͜Ε͸୺຤ͷϞʔγϣϯΛݕ஌͢Δͱಈ࡞͢ΔΫϩʔδϟɻ ͜ͷ෭࡞༻࣮ߦΫϩʔδϟ͸֎෦͔Βݺ͹Εͣɺ ಺෦Ͱ4VCTDSJCFS͕ΠϕϯτΛTFOEͯ͘͠ΕΔɻ

  19. ෭࡞༻࣮ߦΫϩʔδϟͷ಺෦ݺͼग़͠ • ࣗಈͰԿ͔Λ؂ࢹͯ͠มԽ͕͋ͬͨΒAction͕ݺͼग़ͤΔ • Motion • Location • Core DataͷFetch

    Result Controller
  20. %PXOMPBE$MJFOUͷ"DUJPOΛ3FEVDFSʹ఻͑Δ

  21. ·ͱΊ • Action/ErrorΛݸผʹఆٛ • ෭࡞༻࣮ߦΫϩʔδϟ • ΫϩʔδϟΛReducer͕֎෦ݺͼग़͠ • Ϋϩʔδϟ಺෦Ͱউखʹ࣮ߦͤͨ͞Γ