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

Clean Swift Architecture - Swift Mumbai #3

Clean Swift Architecture - Swift Mumbai #3

As an iOS developer, most of them have used Apple's default MVC. Apple’s MVC is good but the view controller ends up being a massive view controller since all the logic is written in the view controller. There are various alternatives for MVC and one of them is clean swift. In this session we will discuss details of how to implement clean swift, writing unit test cases and what were the challenges and learnings while using clean swift architecture in Dream11.

About the Speaker: Vinita Miranda has 7.5+ years of experience in iOS. Currently working as an iOS Developer at Dream11 since July 2017. Prior to this has worked with Upstox, Sportkix, Deloitte, Sportz Interactive and has worked as a freelancer as well as a trainer for Objective C and Swift. Apart from coding, she loves travelling and trying out different varieties of food. You can find Vinita at -
https://twitter.com/vinitavins2007
https://github.com/vinitam
https://www.linkedin.com/in/vinita-miranda-3874a824

Presented at Swift Mumbai - Chapter #3 Meetup: https://www.meetup.com/Swift-Mumbai/events/249701161/

Watch the presentation at: https://youtu.be/Cs1aRxKbBO8

Eeb061c8b2816b771920da1b3e7904a3?s=128

Swift India

April 28, 2018
Tweet

Transcript

  1. Vinita Miranda Clean Swift Architecture

  2. Introduction ! iOS Developer at Dream11 ! Passionate about teaching

    ! I am a foodie and I love exploring new places
  3. 1. SELECT A MATCH From upcoming live matches 2. CREATE

    YOUR TEAM Of real players from that match 2. COMPETE FOR POINTS Based on players’ real-life performance Dream11
  4. Why care about architecture? Distribution Testability Ease of Use

  5. Sample App

  6. MVC Expectation

  7. Reality

  8. Alternative approaches Distribution Testability Easy of Use

  9. Clean Swift Template • https://clean-swift.com/swift-3-compatible/

  10. Clean Swift Architecture

  11. View Controller - Interactor View Controller Interactor Business Logic Protocol

    & Request
  12. None
  13. Models ! It will be of type struct and mostly

    it will contain Request, Response, and ViewModel structs. ! Request – Parameters that need to be sent to the API request. ! Response – Gets the response from the API and stores the appropriate data. ! ViewModel – The data required to be displayed on the UI is stored here. For example, your API returns objects with 10 parameters, but you only need to show 4 of them.
  14. None
  15. Interactor - Presenter Interactor Presenter Presenter Logic Protocol & Response

  16. None
  17. Interactor - Worker Interactor News Worker Account Worker Request

  18. None
  19. Presenter - View Controller Presenter View Controller Display Logic Protocol

    & View Model
  20. None
  21. View Controller - Router View Controller Router Routing Logic Protocol

  22. None
  23. Unit Tests

  24. References ! Template download: https://clean-swift.com/swift-3-compatible/ ! http://slides.com/borlov/arch ! https://clean-swift.com/ !

    https://hackernoon.com/introducing-clean-swift-architecture-vip-770a639ad7bf ! https://github.com/vinitam/SwiftIndia
  25. THANK YOU vinita.vins2007@gmail.com https://www.linkedin.com/in/vinita-miranda-3874a824