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

5 Steps To Better Architecture | Vahram Shamtsyan

5 Steps To Better Architecture | Vahram Shamtsyan

As a part of https://swiftcoders.org initiative, SwiftCoders Armenia has an ambitious goal - connect passionate professionals to share their experience, create a great network and make an impact in their communities.
Our speakers are invited from the best IT companies to share their experience and knowledge.

Watch video of the presentation on YouTube
https://youtu.be/ugAGsLn3-fc

Contact Vahram:
LinkedIn: https://www.linkedin.com/in/vahrams
Facebook: https://www.facebook.com/vahram.shamtsyan

Join SwiftCoders Armenia
https://swiftcoders.am

Facebook
https://www.facebook.com/swiftcoders
Telegram
https://t.me/SwiftCoders
LinkedIn
https://www.linkedin.com/company/swiftcoders-armenia
Eventbrite
https://www.eventbrite.com/o/swiftcoders-armenia-18287883306
Decks
https://speakerdeck.com/swiftcoders
Slack
https://swiftcodersinvite.herokuapp.com

Avatar for SwiftCoders Armenia

SwiftCoders Armenia

March 06, 2019
Tweet

More Decks by SwiftCoders Armenia

Other Decks in Technology

Transcript

  1. About me! • Software Developer since 2006 • iOS Developer

    since 2010 • Mobile Development Team Lead at Joomag since 2015
  2. Traits of good architecture • Each object should have a

    clear role • Testability • Easier maintainability • A large number of reusable components
  3. 1. Modular Architecture 2. Flow Controllers 3. Dumb View Controllers

    4. Dependency Injection 5. Reusable View Components 5 Steps To Better Architecture
  4. • Navigation (Flow Controller) • Storyboard • View Controllers •

    View Protocols • Presenters • Models (View Models) Every module has it’s own
  5. @IBAction func someAction(_ sender: Any) { let storyboard = UIStoryboard(name:

    "SomeStoryboard", bundle: nil) if let vc = storyboard.instantiateViewController(withIdentifier: “someVC") as? SomeViewController { vc.someObject = someObject if let navController = navigationController { navController.pushViewController(vc, animated: true) } } } Without Flow Controller Using Flow Controller @IBAction func someAction(_ sender: Any) { self.flowController?.someAction } func someAction() { let storyboard: UIStoryboard = UIStoryboard(name: "SomeStoryboard", bundle: nil) let viewController: SomeViewController = (storyboard.instantiateViewController(withIdentifier: “someVC") as? SomeViewController)! self.navigationController.pushViewController(viewController, animated: true) }
  6. View Controller = View • the view delegates user interactions

    to the presenter • the presenter contains the logic of handling user interactions • the presenter communicates with model layer, converts the data to UI friendly format, and updates the view • the presenter has no dependencies to UIKit import UIKit View Presenter
  7. SwiftLint https://github.com/realm/SwiftLint A tool to enforce Swift style and conventions,

    loosely based on https://github.com/github/swift-style-guide