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

RIBs でのダイエット

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

RIBs でのダイエット

Avatar for TatsunoriKuri

TatsunoriKuri

February 13, 2020
Tweet

More Decks by TatsunoriKuri

Other Decks in Programming

Transcript

  1. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved ⾃⼰紹介

    2 • Tatsunori Kuri (@kuritatu18) • iOS app Developer • JapanTaxi (2018.9 ~)
  2. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved 今⽇話すこと

    3 - 1.RIBsとは - 2. 画⾯ が複雑なときのダイエット⽅法 - 3.ロジックが複雑なときのダイエット⽅法 - 4.まとめ
  3. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIBs

    との出会い 4 応募 2018.4 2018.6 内定 2018.9.12 2018.9.16 ⼊社 v4リニューアル RIBs 採⽤
  4. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIBs

    とは 6 (https://github.com/uber/RIBs/wiki より)
  5. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIBs

    のコンポーネント 7 - Router - RIB のルーティング - Interactor - ビジネスロジックを持つ - View(Presenter) - レイアウト、ユーザー操作の処理
  6. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIBs

    のコンポーネント 8 - Builder - RIB内の構成要素 Router, Interactor, ViewController と  ⼦RIB Builderのインスタンス化 - RIB 内部への依存性の注⼊と、RIB 間の依存関係の解決
  7. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB

    内のコミュニケーション 9 Router Interactor View Controller Builder Routing Presentable PresentableListener Build()
  8. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB

    のルーティングとライフサイクル 10 Child RIB Router Interactor View Controller Builder Parent RIB Router Interactor View Controller Builder Child RIB の Router を attach
  9. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB

    のルーティングとライフサイクル 11 Child RIB Router load() Interactor View Controller Builder Parent RIB Router Interactor View Controller Builder Child RIB の Router を attach
  10. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB

    のルーティングとライフサイクル 12 Child RIB Router load() Interactor activate() View Controller Builder Parent RIB Router Interactor View Controller Builder Child RIB の Router を attach
  11. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB

    のルーティングとライフサイクル 13 Child RIB Router Interactor View Controller Builder Parent RIB Router Interactor View Controller Builder Child RIB の Router を detach
  12. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB

    のルーティングとライフサイクル 14 Child RIB Router Interactor deactivate() View Controller Builder Parent RIB Router Interactor View Controller Builder Child RIB の Router を detach
  13. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB間のコミュニケーション

    15 Child RIB Router Interactor View Controller Builder Parent RIB Router Interactor View Controller Builder Listener経由で 親RIBの処理を呼ぶ
  14. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIBs

    の特徴:ツリー構造 17 ※注⽂導線の⼀部抜粋:2020年2⽉6⽇時点
  15. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved MicroViewControllerとは

    21 https://www.icloud.com/keynote/0vgTYDXyHQTd0l1FKTiF1jT7g#MicroViewController-en
  16. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIBs

    × MicroViewController 30 - ViewControllable - Router.Init()
  17. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved View

    の無いRIB の追加 38 Owns corresponding view の チェックを外す ViewController の無い RIB が作成される Templete から RIB を選択
  18. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB

    の分割前 39 Parent RIB Router Interactor ・処理A ・処理B ・処理C View Controller Builder
  19. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved RIB

    の分割後 40 Parent RIB Router Interactor ・処理A View Controller Builder B Child RIB Router Builder Interactor ・処理B C Child RIB Router Builder Interactor ・処理C B Child Listener C Child Listener
  20. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved View

    の無い RIB 45 地図を動かした際の緯度/経度でAPI から住所を取得するRIB
  21. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved View

    の無い RIB 46 APIから乗⾞の禁⽌エリア取得と禁⽌ エリア内かの判定をするRIB
  22. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved View

    の無い RIB 47 次の画⾯に必要な情報をAPIから取得 するRIB
  23. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved View

    の無い RIB 48 View の無いRIBから別のViewのある RIB にルーティングすることもある
  24. Proprietary and Confidential ©2017 JapanTaxi, Inc. All Rights Reserved まとめ

    50 - 画⾯とロジックの両⾯からダイエットをすることが可能 - ViewController の平均⾏数:154、500⾏超え1つ - Interactorの平均⾏数:141、500⾏超え2つ - 1つ1つの RIB がスリムになる - 責務が明確になる - 追加、修正による影響が最⼩限に - テストが書きやすい
  25. จষɾը૾౳ͷ಺༰ͷແஅసࡌٴͼෳ੡౳ͷߦҝ͸͝ԕྀ͍ͩ͘͞ɻ Proprietary and Confidential ©2020 JapanTaxi, Inc. All Rights Reserved

    ˟102-0094ɹ౦ژ౎ઍ୅ా۠لඌҪொ3-12 3-12 Kioicho Chiyoda-ku, Tokyo 102-0094 Japan TEL 03-6265-6265ɹFAX 03-3239-8115 www.japantaxi.co.jp