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

Presentation with Coordinators

Presentation with Coordinators

Yusuke Kawanabe

January 10, 2018
Tweet

More Decks by Yusuke Kawanabe

Other Decks in Technology

Transcript

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

    ʮiOS 11 ProgrammingʯͰ͸ୈ8ষ ʮUIKitͷΨΠυϥΠϯ ͷมߋ఺ͱAutoLayoutͷ৽ػೳɺΞοϓσʔτʯΛ୲౰ • ʮΑ͘Θ͔ΔAuto Layoutʯஶऀ • 2017೥͔ΒτϥΠΞεϩϯΛ͸͡ΊϋʔϑΞΠΞϯϚϯʹ Lead iOS Engineer at Nima
  2. 9 NimaΞϓϦઃܭ֓ཁ Coordinator Scene View Controller View Model Context Interactor

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

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

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

    Model Model Presentation Use Case Business Logic Use Case View
  6. 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͸ՄೳͳݶΓΞϗʹ • ࢖͍ࣺͯ
  7. 14 NimaΞϓϦઃܭ֓ཁ Coordinator Scene View Controller View Model Context Interactor

    Model Model View • ϓϨθϯςʔγϣϯϢʔεέʔεΛ؅ཧ͢Δ • e.g. Ϣʔβʔొ࿥ϑϩʔɺϨετϥϯݕࡧϑ ϩʔͳͲ Presentation Use Case Business Logic Use Case
  8. 16 Scene Coordinators and Scenes Scene Scene Coordinator •͋Δϑϩʔ಺ͷ֤ϏϡʔΛఆ͍ٛͯ͠ΔɻView ModelΛड͚औΓView

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

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

    •ΞϓϦىಈ࣌ͷը໘ఏڙΛ؅ཧ͢ΔɻͦͷͨΊɺKey WindowΛࢀর͠ɺಛఆͷϑϩʔΛ։࢝͢Δ •ىಈ࣌ͷॲཧΛɺApp Delegate౳ʹॻ͔ͳͯ͘͢Ή ϩάΠϯࡁΈ ະϩάΠϯ Key window Λऔಘ Loading Scene Coordinator
  11. 20 •֤CoordinatorʹͯඞཁʹԠ ͯ͡ॱংΛมߋ͢ΔͷΈ UIશվम •View Controller͕Viewɺ View Modelͱͷ઀ଓΛ୲౰͢ ΔͷΈʹͳΔͷͰɺ෭࡞༻͕ ࠷খʹɻViewٴͼɺView

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