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

Presentation with Coordinators

Presentation with Coordinators

Bff092f77c1870ed4fba5238874776c9?s=128

Yusuke Kawanabe

January 10, 2018
Tweet

Transcript

  1. Presentation with Coordinators Yusuke Kawanabe (@ykawanabe)

  2. 2 Yusuke Kawanabe (@ykawanabe) • San FranciscoͰConnected Food SensorͷΞϓϦΛ։ൃ •

    ʮiOS 11 ProgrammingʯͰ͸ୈ8ষ ʮUIKitͷΨΠυϥΠϯ ͷมߋ఺ͱAutoLayoutͷ৽ػೳɺΞοϓσʔτʯΛ୲౰ • ʮΑ͘Θ͔ΔAuto Layoutʯஶऀ • 2017೥͔ΒτϥΠΞεϩϯΛ͸͡ΊϋʔϑΞΠΞϯϚϯʹ Lead iOS Engineer at Nima
  3. 3 Nima • ੈքॳͷϙʔλϒϧάϧςϯηϯαʔٴͼ ϐʔφοπηϯαʔʹΑͬͯɺ৯୎ʹ҆৺ Λಧ͚͍ͯΔ • CES 2016ͷTechCrunch Hardware

    Battlefieldʹͯ༏উ • CES 2018ʹͯϐʔφοπηϯαʔΛൃද
  4. 4 ΞϓϦ։ൃ͸೉͍͠

  5. 5 •ྫ͑͹ɺϑϦϚΞϓϦʹͯɺ ϩάΠϯը໘ΛɺΞϓϦىಈ ͔࣌Β঎඼બ୒ޙʹมߋ͢Δ A/BςετΛ͍ͨ͠ͳͲɻ UIશվम •ݟͨ໨ͷϦχϡʔΞϧɻ࠷ऴ తʹ͸ΞϓϦΛ࠶ߏங͢Δඞ ཁʹഭΒΕΔ͜ͱ͕ଟ͍ •ྫ͑͹MVVMΛ࠾༻ͨ͠৔

    ߹ʹɺView ModelʹϏδωε ϩδοΫ͕ूத͠৑௕ͳView Modelͱͳͬͯ͠·͏ͳͲɻ Ϣʔβʔϑϩʔมߋ ࠶ར༻ੑͷ௿͞ Ή͔͠ࠔͬͨ͜ͱ
  6. 6 ॊೈੑɺݎ࿚ੑɺ࠶ར༻ੑ Λߟ͑ΞϓϦΛ࠶ߏங͓ͨ͠࿩

  7. 7 NimaͰ͸ʁ

  8. 8 NimaΞϓϦͰͰ͖Δ͜ͱ

  9. 9 NimaΞϓϦઃܭ֓ཁ Coordinator Scene View Controller View Model Context Interactor

    Model Model Presentation Use Case Business Logic Use Case View
  10. 10 NimaΞϓϦઃܭ֓ཁ Coordinator Scene View Controller View Model Context Interactor

    Model Model Presentation Use Case Business Logic Use Case View
  11. 11 NimaΞϓϦઃܭ֓ཁ Coordinator Scene View Controller View Model Context Interactor

    Model Model View • Use caseୡΛ؅ཧ͢ΔΫϥε • ྫʣϢʔβʔ͸ϨετϥϯҰཡΛऔಘͰ͖Δ Presentation Use Case Business Logic Use Case
  12. 12 NimaΞϓϦઃܭ֓ཁ Coordinator Scene View Controller View Model Context Interactor

    Model Model Presentation Use Case Business Logic Use Case View
  13. Presentation Use Case Business Logic Use Case 13 NimaΞϓϦઃܭ֓ཁ Coordinator

    Scene View Controller View Model Context Interactor Model Model View • MVVMͰͷView Modelͱಉ༷ͷ໾ׂ • දࣔʹඞཁͳঢ়ଶͷอ࣋ͱɺView Controller͔Βͷೖྗ؅ཧ • ࢖͍ࣺͯ • MVVMͰͷView Controllerͱಉ༷ͷ໾ׂ • ViewͱView ModelΛܨ͙ͷΈ • View Controller͸ՄೳͳݶΓΞϗʹ • ࢖͍ࣺͯ
  14. 14 NimaΞϓϦઃܭ֓ཁ Coordinator Scene View Controller View Model Context Interactor

    Model Model View • ϓϨθϯςʔγϣϯϢʔεέʔεΛ؅ཧ͢Δ • e.g. Ϣʔβʔొ࿥ϑϩʔɺϨετϥϯݕࡧϑ ϩʔͳͲ Presentation Use Case Business Logic Use Case
  15. 15 Coordinator App Coordinator Coordinator Navigation Coordinator Scene Coordinator

  16. 16 Scene Coordinators and Scenes Scene Scene Coordinator •͋Δϑϩʔ಺ͷ֤ϏϡʔΛఆ͍ٛͯ͠ΔɻView ModelΛड͚औΓView

    ControllerΛฦ͢ɻ •͋ΔϑϩʔΛఆ͍ٛͯ͠Δɻ֤View ModelΛ؂ ࢹ࣍͠ͷSceneΛදࣔ͢Δɻ •͋Δϑϩʔʹ͓͚Δঢ়ଶΛอ࣋͢Δ •View Controller͕φϏήʔγϣϯʹؔ͢Δ஌ࣝΛ ࣋ͨͳ͍ welcome signup Name signup Email signup Password
  17. signup Password 17 Navigation Coordinator welcome signup Name signup Email

    Welcome Scene Coordinator Restaurant Scene Coordinator Review Scene Coordinator •Scene CoordinatorୡΛ؅ཧ͠ɺΞϓϦ಺Ͱͷը໘ભҠΛ؅ཧ͢Δɻ •্هͷΑ͏ͳΠϯλʔϑΣʔεΛ࣋ͪɺCoordinatorͷදࣔॱংΛ؅ཧ͢Δɻ •ϑϩʔͷೖΕସ͕͑༰қ
  18. 18 App Coordinator ىಈ Welcome Scene Coordinator Restaurant Scene Coordinator

    •ΞϓϦىಈ࣌ͷը໘ఏڙΛ؅ཧ͢ΔɻͦͷͨΊɺKey WindowΛࢀর͠ɺಛఆͷϑϩʔΛ։࢝͢Δ •ىಈ࣌ͷॲཧΛɺApp Delegate౳ʹॻ͔ͳͯ͘͢Ή ϩάΠϯࡁΈ ະϩάΠϯ Key window Λऔಘ Loading Scene Coordinator
  19. 19 ໰୊͸Ͳ͏ղܾ͞Ε͔ͨ

  20. 20 •֤CoordinatorʹͯඞཁʹԠ ͯ͡ॱংΛมߋ͢ΔͷΈ UIશվम •View Controller͕Viewɺ View Modelͱͷ઀ଓΛ୲౰͢ ΔͷΈʹͳΔͷͰɺ෭࡞༻͕ ࠷খʹɻViewٴͼɺView

    ControllerΛஔ͖׵͑ΔͷΈͰ ରԠՄೳɻ •ϓϨθϯςʔγϣϯͱϏδ ωεϩδοΫ͕໌֬ʹ෼͚Β Ε͍ͯΔͨΊɺϏδωεϩ δοΫ΋࠶ར༻ੑ͕ߴ͘ͳ Δɻ Ϣʔβʔϑϩʔมߋ ࠶ར༻ੑͷ௿͞ ΞϓϦ։ൃͰΑ͋͘ΔࠔΔ͜ͱ
  21. 21 ·ͱΊ

  22. 22 • NimaͷΞϓϦΛ࠶ߏஙͨ͠ • ΞϓϦ։ൃ͸೉͍͠ • ιϑτ΢ΣΞΞʔΩςΫνϟʔͷબ୒ʹΑΓૣ͍։ൃ଎౓Λอͪͭͭɺॊ ೈੑɺݎ࿚ੑɺ࠶ར༻ੑͷߴ͍ίʔυΛҡ࣋͠΍͘͢ͳΔ • ৑௕ʹͳΓ͗͢ͳ͍Α͏ʹɺ։ൃΛ͠ͳ͕ΒɺඞཁʹԠͯ͡ઃܭͨ͠

    • ։ൃମ੍΍ΞϓϦͷཁ݅ʹ͋Θͤͯ࠷దղ͸มΘΔ ·ͱΊ