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

Mercari iOSクライアント Re-Architectureのその後 / After Re-Architecture of Mercari iOS client

Builders Box
February 15, 2021

Mercari iOSクライアント Re-Architectureのその後 / After Re-Architecture of Mercari iOS client

■イベント 

【Engineering Team Presentation】各社の事業を支えるアーキテクチャ
https://sansan.connpass.com/event/200589/

■登壇概要
タイトル:Mercari iOSクライアント Re-Architectureのその後
発表者:株式会社メルカリ Personalization Team
iOS Tech Lead 芳賀 優樹

▼Builders Box
https://buildersbox-online.com/

Builders Box

February 15, 2021
Tweet

More Decks by Builders Box

Other Decks in Technology

Transcript

  1. 6 Item Detail VC • Show Product Images • Show

    Product Name • Show Brand Name if available • Show Price • Show Merpay Balance if available • Call Like API • Navigate to comment screen • Call purchase API …. And more
  2. 8

  3. 9 Product Image VC • Show Product Images Product Name

    VC • Show Product Name • Show Brand Name if available Product Price VC • Show Price • Show Merpay Balance if available Like Button VC • Call Like API Comment Button VC • Navigate to comment screen Purchase Button VC • Call purchase API
  4. 10 Micro View Controllerとは? • 一つの画面を複数のView Controllerに分ける。 • それらのVCのViewをUIStackViewでつなげ、UIScrollViewにのせる。 ◦

    各VCが自分のViewのサイズを決定 ◦ 親VCが最終的なContent Sizeを決定 • UIStackViewでUIViewControllerをつなげる部分(ContainerView)や Input, Output, Dependency Injectionに関するProtocol等を共有 Frameworkとして提供する。
  5. 12

  6. 19

  7. 20

  8. 22

  9. 28 sections.append(contentsOf: [ .group([ .detailPush(title: "My profile".localizedString, selectionBlock:pushToMyProfile), .detailPush(title: "Saved

    and viewed items".localizedString, selectionBlock:pushToMyLikesAndViews), .detailPush(title: "Listings".localizedString, selectionBlock:pushToMyListings), .detailPush(title: "Purchases".localizedString, selectionBlock:pushToMyPurchases), .detailPush(title: "Instant offers".localizedString, selectionBlock:pushToInstantSales) ]), .gap(), .group([ .detailPush(title: "Settings".localizedString, selectionBlock:pushToSettings), .detailPush(title: "Support messages".localizedString, selectionBlock:pushToMercariNews), .detailPush(title: "Help centre".localizedString, selectionBlock:pushToHelpCenter) ]), .gap() ])
  10. 30 結論 • アーキテクチャに正解はない。 • 各View ControllerのInput, Output, Dependency Injectionに関する

    Protocolは統一されているが、内部のArchitectureはある程度各チームの裁 量に任せる。
  11. 32

  12. 33

  13. 35 UIStackView vs UICollectionView • UIStackViewはsub viewが自分でviewの大きさを決めるのに対して UICollectionViewは親がsub viewの大きさを決める(self-sizingを使わな ければ)。

    • UICollectionViewはDifference UpdateにUIKitがアニメーションをつけて くれる。 • UICollectionViewの場合、sub viewのインスタンスは見た目よりも多く作ら れる。
  14. 36 まとめ • Mercari iOSのアーキテクチャ ◦ Micro View Controllerによるロジックの分散、カプセル化 ◦

    各View ControllerのInput, Output, Dependency Injectionに関す るProtocolの統一 ◦ StoreによるStateの同期 ◦ UIStackViewやUICollectionViewによるContainerViewの仕組み