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

iOS アプリとMVA

iOS アプリとMVA

Re:try! Swift で発表した資料です。
https://mokumoku-ios-at-next.connpass.com/event/51983/

## 参考資料

Minimum Viable Architecture -- Good Enough is Good Enough in a Startup
https://www.slideshare.net/RandyShoup/minimum-viable-architecture-good-enough-is-good-enough-in-a-startup

iOSアプリ設計大全集 2016
http://qiita.com/tattn/items/d4b95af0b60c3849243a

10分で振り返るソフトウェアアーキテクチャの歴史2017
https://speakerdeck.com/takasek/10fen-tezhen-rifan-rusohutoueaakitekutiyafalseli-shi-2017

データレイヤを分離する (LT) | try! Swift Tokyo 2017 #tryswiftconf Day1-9 聞き起こし
http://niwatako.hatenablog.jp/entry/2017/03/02/154103

266af7918931b0ea15eae9e8f42ecfa6?s=128

kumamotone

March 31, 2017
Tweet

Transcript

  1. iOSΞϓϦͱMVA Re:try! Swift 2017/03/31 1

  2. ࣗݾ঺հ • ۽ຊ ࿨ਖ਼ • ࢁޱݝग़਎ • iOSΤϯδχΞˏYahoo! JAPAN •

    CAMPFIRE (#yjcamp) iOSओ࠻ • Twitter: @kumamo_tone • Github: @kumamotone 2
  3. ઃܭʹ·ͭΘΔ೰Έ • େن໛ͳΞϓϦͰى͜Γ͕ͪͳ໰୊ • ViewController ͕ංେԽ͍ͯ͠Δ • Ϟσϧ͕͙ͪΌ͙ͪΌʹͳ͍ͬͯΔ • ͲΜͳઃܭʹͨ͠Βྑ͍ͷ͔Θ͔Βͳ͍

    • ઃܭΛద༻͕ͨ͠ίʔυྔ͕૿͑͗ͨ͢ 3
  4. σʔλϨΠϠΛ෼཭͢Δ try! Swift Tokyo 2017 Day1-9 4

  5. σʔλϨΠϠΛ෼཭͢Δ ϨΠϠʔΛ੹຿ผʹ෼͚ΒΕΕ͹ΞʔΩςΫνϟ͸ԿͰ΋ྑ͍ • ϨΠϠʔΛ·͙ͨ σʔλ͸ BasicStruct ʹཹΊΔɻ ୯७ͳσʔλߏ଄͕ڥքΛ௒͑Δͱ͍͏͜ͱ͕ॏཁ • Realm

    Object ΍ CoreData ͷΦϒδΣΫτ͸ σʔλϨΠϠʔ͔Β֎ʹग़͞ͳ͍΄͏͕ྑ͍ 5
  6. σʔλϨΠϠΛ෼཭͢Δ • M: Minimum V: Viable A: Architecture ͷ঺հ •

    ೔ຊޠͰ͸ඞཁ࠷খݶͷΞʔΩςΫνϟ • ΞʔΩςΫνϟͱ͍͏ΑΓ͸ϝλ֓೦ • ΞʔΩςΫνϟઓࠃ࣌୅ͷiOSΞϓϦ։ൃք۾ʹͱͬͯ ྑ͍ݴ༿ͱײͨ͡ 6
  7. σʔλϨΠϠΛ෼཭͢Δ • MVA1 • MVC ͩͱViewController͕ංେ͕ͪ͠ɺ ͳΜͰ΋Ͱ͖ΔਆManager஀ੜ͕ͪ͠ • Clean Architecture,

    VIPER ͳͲ͸ɺ΍Γ͗͢ͳ͜ͱ͕ଟ͍ • ͓ͦΒ͘ MVP ΍ MVVM ʹ͓ͪͭ͘͜ͱ͕ଟ͍ 1 https://www.slideshare.net/RandyShoup/minimum-viable-architecture-good-enough-is-good-enough-in-a-startup 7
  8. MVA ʹ͢Δʹ͸Ͳ͏͢Ε͹͍͍͔ • ઃܭΛͬ͘͟Γ஌Δ • ੍࡞෺ͷಛ௃Λ஌Γɺ࠷খݶͷ΋ͷΛద༻͢Δ • νʔϜͰ࿩͠߹͏ 8

  9. ઃܭΛͬ͘͟Γ஌Δ • ઌਓͷ·ͱΊΛݟΔ • iOSΞϓϦઃܭେશू 2016 2016, tattn • 10෼ͰৼΓฦΔιϑτ΢ΣΞΞʔΩςΫνϟͷྺ࢙2017

    2017, takasek 2017, takasek https://speakerdeck.com/takasek/10fen-tezhen-rifan-rusohutoueaakitekutiyafalseli-shi-2017 2016, tattn http://qiita.com/tattn/items/d4b95af0b60c3849243a 9
  10. ઃܭΛͬ͘͟Γ஌Δ • Model + □□ • MVC / MVVM /

    MVP • ੹຿͕ࡉ͔ܾ͘·͍ͬͯΔ • VIPER / Clean Architecture 10
  11. ઃܭΛͬ͘͟Γ஌Δ • MVP • MVC ͷ ViewController ͷංେԽΛղܾ • (iOSΞϓϦͷ࣮૷Ͱ͸)

    MVCʹPresenter(P) ͕͍ͭͨ΍ͭ P ͸ UI ͷ͜ͱΛ஌Βͳ͍ • MVVM • ΄΅ MVPɻModelͷมߋΛݕ஌͠ɺViewʹ఻͑Δ࢓૊Έ 11
  12. ઃܭΛͬ͘͟Γ஌Δ • VIPER • P ͱ M Λ P ͱ

    I ͱ E ͱ M ʢͱRʣʹ • MVPΑΓ۠෼͕૿͑ͯɺΑΓ੹຿͕໌֬ʹ • CleanArchitecture • ԁঢ়ʹ૚Λ෼ׂɹ੹຿աଟΛղফͭͭ͠ɺ ΍ΓͱΓ͕֎͔Βத΁੍ݶ͞Ε͍ͯΔͷͰɺͨ͘͞Μґଘ 12
  13. ੍࡞෺ͷಛ௃Λ஌Γɺ࠷খݶͷ΋ͷΛద༻͢Δ • GUI ΞϓϦέʔγϣϯͰ͋ΔɹiOSΞϓϦͰ͋ΔʢUIKit ͷଋ റ͕͋Δʣ • VCͷංେԽɺCͷVͷϥΠϑαΠΫϧ΁ͷґଘ → MVVM

    / MVPʁ • ͞Βʹେن໛ʹͳ͖ͬͯͨ • MVP ͷ Presenter, Model ͕͙ͪΌ͙ͪΌʹͳ͖ͬͯͨ 13
  14. νʔϜͰ࿩͠߹͏ • ઃܭɺϞδϡʔϧͷ੹຿ɺ༻ޠͷղऍΛ໌֬ʹͯ͠ڞ༗͢Δ • Ͳ͏࡞Δ͔͸νʔϜ࣍ୈ • ◦◦͸Ͳ͜ʹஔ͔͘ʁ☓☓はどういう命名規則にするか? • ঃʑʹద༻͢Δ 14

  15. ·ͱΊ • MVA = "ඞཁ࠷খݶͷΞʔΩςΫνϟ" Λҙࣝ͢Δ • ઃܭͷ͜ͱΛ஌Δ • ੍࡞෺ͷಛ௃Λ஌Γɺ࠷খݶͷ΋ͷΛద༻͢Δ

    • νʔϜͰ࿩͠߹͏ 15