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

MTC2018 - Implementing TypeErasure in ViewContr...

mercari
October 04, 2018

MTC2018 - Implementing TypeErasure in ViewController

Speaker: Nobuo Saito

To develop our app, we use MicroViewController, which we introduced at iOSDC, and we have also implemented the idea of MicroFrameworks. A common issue with using MicroFrameworks is circular dependencies, but by using the MicroViewController model, we can implement TypeErasure for ViewController. We call this ViewControllerRequest. Today I will talk about ViewControllerRequest, our prized service that solved the problem of circular dependencies and greatly reduced the work required for refactoring.

mercari

October 04, 2018
Tweet

More Decks by mercari

Other Decks in Technology

Transcript

  1. Technical Assets Features work properly Features can be reused New

    features are not added Code cannot be accessed
  2. All modules import Kit/Entity The app imports all modules    

    MercariKit     MercariEntity     Prod1     Listing     ItemDetail     Search     Mercari     Prod2     Prod3
  3.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 ItemDetail cannot import Search
  4.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 Get all Mercari resources from EnvironmentProvider EnvironmentProvider User GetProfileRequest MercariEnvironment
  5.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 Definition of request Type class, Type implementation DIP (Dependency Inversion Principle) protocol struct function
  6.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 3 protocols defined in MercariKit Injectable/Interactable
  7.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 Make ViewControllers Input/Output in MercariEntity Injectable/Interactable Input Output
  8.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 Mercari can import Search Injectable/Interactable Input Output let vc = SearchVC(...)
  9.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 Get ViewController instance from EnvironmentProvider API Gateway for VC ViewControllerRequest Search IO let vc = SearchVC(...)
  10.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 Code cannot be referenced Features work properly
  11.     MercariKit     MercariEntity     Prod1     Listing     ItemDetail

        Search     Mercari     Prod2     Prod3 _人人人人人人人人_ >Huge buried treasure!<  ̄Y^Y^Y^Y^Y^Y^Y^ ̄ ViewControllerRequest ViewControllers IO WrapperOfObjC
  12. Conclusion Divide the framework Split duties and turn liabilities into

    assets To do that, types should be well-defined