An (highly elementary) introduction to VIPER

21
Daniela Jovanoska Petrenko [email protected] @denicija VIPER

Transcript of An (highly elementary) introduction to VIPER

Page 1: An (highly elementary) introduction to VIPER

Daniela Jovanoska Petrenko [email protected]

@denicija

VIPER

Page 2: An (highly elementary) introduction to VIPER

An (highly elementary) introduction to Daniela Jovanoska Petrenko [email protected]

@denicija

VIPER

Page 3: An (highly elementary) introduction to VIPER

“It is not enough for code to work.”― Robert C. Martin, Clean Code: A Handbook of Agile

Software Craftsmanship

Page 4: An (highly elementary) introduction to VIPER

The search for the hollyarchitecture

Page 5: An (highly elementary) introduction to VIPER

The search for the holly

architecturemobile

Page 6: An (highly elementary) introduction to VIPER

Source:https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia-CocoaCore/MVC.html

Page 7: An (highly elementary) introduction to VIPER

Source: Ugaya40 (Own work) [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons

Page 8: An (highly elementary) introduction to VIPER

Source: blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html

Page 9: An (highly elementary) introduction to VIPER

VIP(ER)

Page 10: An (highly elementary) introduction to VIPER

Source: https://medium.com/ios-os-x-development/ios-architecture-patterns-ecba4c38de52#.cqp3sgpj9

Page 11: An (highly elementary) introduction to VIPER

View

Display information to the user and detect user interaction

Page 12: An (highly elementary) introduction to VIPER

Presenter

Contains the UI related (UIKit independent) business logic.

Page 13: An (highly elementary) introduction to VIPER

Interactor

Performs business logic  “Contains business logic related to the data (Entities) or networking, like creating new

instances of entities or fetching them from the server. For those purposes you’ll use some Services and Managers which are not considered as a part of VIPER module but

rather an external dependency.”

Page 14: An (highly elementary) introduction to VIPER

Entities

Plain data objects “Not all models (transport data structures) are Entities”

Page 15: An (highly elementary) introduction to VIPER

Router/Wireframe

The router/wireframe is what glues all of the other VIPER components to one

another and handles navigating from one view to another in the app.

Page 16: An (highly elementary) introduction to VIPER

Binding it all together

It’s up to you!

Page 17: An (highly elementary) introduction to VIPER

Conclusion

‣ Separation of concerns ‣ Increased testability ‣ Reusability

‣ Spagetti code ‣ Verbosity ‣ Onboarding time for new developers

Page 18: An (highly elementary) introduction to VIPER

Conclusion

‣ Separation of concerns ‣ Increased testability ‣ Reusability

‣ Spagetti code ‣ Verbosity ‣ Onboarding time for new developers

Page 19: An (highly elementary) introduction to VIPER

“There are two parts to learning craftsmanship: knowledge and work.

You must gain the knowledge of principles, patterns, practices, and heuristics that a craftsman

knows, and you must also grind that knowledge into your fingers, eyes, and gut by working hard and

practicing.”

― Robert C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship”

Page 20: An (highly elementary) introduction to VIPER

Resources and further reading

‣ Ruby gem for generating VIPER files (https://github.com/rambler-ios/Generamba

‣ Clean architecture blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html

‣ Testimonials http://www.outware.com.au/insights/ios-architecture-real-life-viper/ https://medium.com/ios-os-x-development/ios-architecture-patterns-ecba4c38de52#.cqp3sgpj9 https://medium.com/brigade-engineering/brigades-experience-using-an-mvc-alternative-36ef1601a41f#.srtvevutv

‣ Clean Swift http://clean-swift.com/clean-swift-ios-architecture/

Page 21: An (highly elementary) introduction to VIPER

Thank you!