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

Unidirectional Data Flow in ReSwift

Masato Oshima
February 09, 2016

Unidirectional Data Flow in ReSwift

Kyobashi.swift #1

Masato Oshima

February 09, 2016
Tweet

More Decks by Masato Oshima

Other Decks in Programming

Transcript

  1. Unidirectional Data Flow
    in ReSwift
    @_mpon
    Kyobashi.swift #1

    View full-size slide

  2. Masato Oshima
    github.com/mpon
    @_mpon
    ಢ໦ݝ๕լ܊ग़਎
    iOS Developer

    View full-size slide

  3. DDoommaaiinn


    DDrriivveenn


    DDeessiiggnn

    View full-size slide

  4. ͋Δ೔ͷ4MBDL

    View full-size slide

  5. ͱ͍͏͜ͱͰ
    3F4XJGU
    Λௐ΂ͯΈΔ

    View full-size slide

  6. Ұఆํ޲ͷΈͷσʔλϑϩʔJO4XJGU
    3FEVY͔ΒΠϯεύΠΞ͞Εͨ

    View full-size slide

  7. b`3FEVYJTBOBMUFSOBUJWF
    PSBWBSJBUJPOPGUIF
    qVYGSBNFXPSL``

    View full-size slide

  8. b`'MVYJTUIFBQQMJDBUJPO
    BSDIJUFDUVSFUIBU'BDFCPPLVTFT
    GPSCVJMEJOHDMJFOUTJEFXFC
    BQQMJDBUJPOT``

    View full-size slide

  9. Ұఆํ޲ͷΈͷσʔλϑϩʔ
    4UPSF͸ࣗ෼ࣗ਎Λॻ͖׵͑Δ

    View full-size slide

  10. +BWB4DSJQUΞϓϦέʔγϣϯͷͨΊͷϑϨʔ
    ϜϫʔΫɻ'MVYΛਐԽͤͯ͞ෳࡶੑΛճආ͠
    Α͏ͱ͍ͯ͠Δɻ

    View full-size slide

  11. 3FEVYͱಉ͡ߏ੒

    View full-size slide

  12. 4UPSF͸ΞϓϦέʔγϣϯ
    ͷ4UBUFΛ؅ཧ͍ͯ͠Δɻ
    "DUJPO͸4UPSFͷ4UBUFΛ
    มߋ͢ΔͨΊͷએݴ͕ॻ
    ͔Ε͍ͯΔɻ
    3FEVDFS͸"DUJPOΛड͚
    औͬͯ৽͍͠4UBUFΛฦ
    ͢ɻ

    View full-size slide

  13. ϘλϯΛλοϓͨ͠ͱ͖ʹ"DUJPOΛੜ੒ͯ͠ɺ
    4UPSFʹEJTQBUDI͢Δɻ

    View full-size slide

  14. 4UPSF͸ड͚औͬͨ"DUJPOΛ3FEVDFSʹ౉
    ͢ɻ

    View full-size slide

  15. 3FEVDFS͸"DUJPOΛ΋ͱʹ৽͍͠4UBUF
    Λฦ͢ɻ

    View full-size slide

  16. 4UPSF͸৽͍͠4UBUFΛ4VCTDSJCF͍ͯ͠Δશ
    ͯͷ7JFXʹ௨஌͢Δɻ

    View full-size slide

  17. 7JFX$POUSPMMFS͕TUPSFΛTVCTDSJCF͢Δɻ

    View full-size slide

  18. ϘλϯΛԡͨ͠ͱ͖ʹɺ"DUJPOΛੜ੒ͯ͠ɺ
    4UPSFʹEJTQBUDI͢Δɻ

    View full-size slide

  19. 4UPSF͸"QQ%FMFHBUFͰͨͩͭଘࡏͯ͠શͯͷঢ়ଶΛ؅
    ཧ͍ͯ͠Δɻͦͯ͠ɺ4UPSF͸3FEVDFSΛ࣋ͪɺ3FEVDFS
    ͸IBOEMF"DUJPOͱ͍͏ϝιουΛඞͣ࣋ͭɻ
    IBOEMF"DUJPO͸͖ͬ͞EJTQBUDI͞Εͨ"DUJPOͱݱࡏͷ
    TUBUFΛ΋ͱʹ৽͍͠"QQ4UBUFΛੜ੒͢Δɻ

    View full-size slide

  20. 3FEVDFS͸"DUJPOͷछྨʹΑͬͯॲཧΛߦ͍৽͍͠
    TUBUFΛੜ੒͢Δɻ΋ͱͷTUBUFΛมߋ͢Δ͜ͱ͸͠
    ͳ͍ɻ

    View full-size slide

  21. 4UPSF͔Β৽͍͠TUBUF͕OPUJGZ͞ΕΔͷͰɺTUBUFΛ
    ΋ͱʹɺϥϕϧͷදࣔΛߋ৽͢Δɻ

    View full-size slide

  22. ΞϓϦ͕େ͖͘ͳ͖ͬͯͨ
    ͱ͖ʹ4UBUF͕େมͳ͜ͱʹ
    ͳΓͦ͏ʁ
    খ͞ͳมߋʹରͯ͠WJFXͷ
    ࠶ඳըͷύϑΥʔϚϯε͸
    Ͳ͏ͳΜͩΖ͏ʁ
    "OJNBUJPOͷ్தঢ়
    ଶ΋؅ཧ͢Δͷ͔ʁ

    View full-size slide

  23. ࢀߟʹͨ͠αΠτ
    w IUUQTSFBMNJPOFXTCFOKJFOD[VOJEJSFDUJPOBMEBUBqPXTXJGU
    w IUUQGBDFCPPLHJUIVCJPqVYEPDTPWFSWJFXIUNM
    w IUUQTHJUIVCDPN3F4XJGU3F4XJGU
    w IUUQTHJUIVCDPNSBDLUSFEVY
    w IUUQJOTJEFQJYJWOFUFOUSZ
    w IUUQRJJUBDPNLJJUBJUFNTBGCDGC

    View full-size slide

  24. ReSwift
    ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ

    View full-size slide