SlideShare a Scribd company logo
1 of 29
Download to read offline
iOS: MVVMC
MobileMonday
15 May 2017
Aleksandr Nikolajev
iOS developer
ME
• Graduated as material scientist in University of
Tartu
• Joined Mooncascade in 2015
• FinTech, transportation, multimedia, sports,
utilities
AGENDA
• Introduction to MVVMC and it’s pieces
• Some examples
• Unit testing
• Tight coupling between View and Controller
• Hard to test interactions between View and
Controller
• Model can be testable
THE PROBLEM WITH
APPLE’s MVC
• An architecture pattern
• Model - View - ViewModel - Coordinator
• MVVMC treats UIViewController as a dumb
presenter - just a view
WHAT IS MVVMC ?
HOW IT WORKS ?
• Coordinator - owns View and/or another Coordinator(s), notifies Coordinator(s)
• View - owns ViewModel, notifies ViewModel (e.g button tap)
• ViewModel - owns Model, updates View, notifies Coordinator
Model
• Usually a protocol
• C.R.U.D - Create, Read, Update, Delete
• Uses functions, NOT properties
• Injected into ViewModel
ViewModel
• Usually a class
• Independent of UIKit
• Injected into View and has no idea what the View is
• Business logic
• Operate with Model
• Provide presentation data to view and notify if that data has
changed
• Communicate states to Coordinator
Coordinator
• Declared as a protocol
• Handle navigation
• Create View and inject ViewModel into it
COMPLEX FLOWS
• Many UIViewControllers
• Many options to choose where to go
• Does the UIViewController has to know what to
show next?
View
• UIViewController is also a View !!!
• Present human readable data
• Do the layout
• Inform ViewModel about interactions
NOT ONLY UIViewController
• There is no rule about using ViewModels only
with UIViewController
• You can use ViewModels on almost on every UI
element
• UITextField, UIButton, …
NOT ONLY UIViewController
• This will decrease your code lines in ViewModel
• Makes code more distributed and increases
reusability
• Adds more flexibility to write unit tests
HOW IT COMES
TOGETHER?
• The GOD — AppCoordinator
• Only AppDelegate knows about AppCoordinator
• Desides what to show when app is finished
launching
UNIT TESTING
• ViewModel gets notified about events happened
in the view - we can test what is the result
• Test if presentation data is formatted correctly (e.g
convert Date object into formatted date string)
• Test if correct delegate method is called when it’s
needed to move on with the flow
• Test if errors are shown to view
• Well distributed code
• Good testability
• Easy of use
THE PROFIT
• MVVM-C A simple way to navigate

http://tech.trivago.com/2016/08/26/mvvm-c-a-
simple-way-to-navigate
• iOS Architecture Patterns

https://medium.com/ios-os-x-development/ios-
architecture-patterns-ecba4c38de52
REFERENCES
THANK YOU!
If you wish to play with the code, clone this
repo
https://github.com/sasnik/MoMoMVVMC

More Related Content

Similar to "iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade

MVC architecture in software programming for interactive apps
MVC architecture in software programming for interactive appsMVC architecture in software programming for interactive apps
MVC architecture in software programming for interactive appsKotiTenali
 
реалии использования Mv в i os разработке
реалии использования Mv в i os разработкереалии использования Mv в i os разработке
реалии использования Mv в i os разработкеProvectus
 
Write cleaner, maintainable, and testable code in Android with MVVM
Write cleaner, maintainable, and testable code in Android with MVVMWrite cleaner, maintainable, and testable code in Android with MVVM
Write cleaner, maintainable, and testable code in Android with MVVMAdil Mughal
 
iOS architecture patterns
iOS architecture patternsiOS architecture patterns
iOS architecture patternsallanh0526
 
Mvc pattern and implementation in java fair
Mvc   pattern   and implementation   in   java fairMvc   pattern   and implementation   in   java fair
Mvc pattern and implementation in java fairTech_MX
 
MVVM presentation
MVVM presentationMVVM presentation
MVVM presentationInova LLC
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesQamar Abbas
 
Introduction To MVVM
Introduction To MVVMIntroduction To MVVM
Introduction To MVVMBoulos Dib
 
software architecture
software architecturesoftware architecture
software architecturearnav gupta
 
Models used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVMModels used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVMAndrei Popa
 
MVVM in iOS presentation
MVVM in iOS presentationMVVM in iOS presentation
MVVM in iOS presentationG ABHISEK
 
Android architectural components
Android architectural componentsAndroid architectural components
Android architectural componentsMuhammad Ali
 
iOS Coding Best Practices
iOS Coding Best PracticesiOS Coding Best Practices
iOS Coding Best PracticesJean-Luc David
 
VIPER Architecture
VIPER ArchitectureVIPER Architecture
VIPER ArchitectureAhmed Lotfy
 

Similar to "iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade (20)

Knockout js
Knockout jsKnockout js
Knockout js
 
MVVM and Prism
MVVM and PrismMVVM and Prism
MVVM and Prism
 
MVP Clean Architecture
MVP Clean  Architecture MVP Clean  Architecture
MVP Clean Architecture
 
MVC architecture in software programming for interactive apps
MVC architecture in software programming for interactive appsMVC architecture in software programming for interactive apps
MVC architecture in software programming for interactive apps
 
реалии использования Mv в i os разработке
реалии использования Mv в i os разработкереалии использования Mv в i os разработке
реалии использования Mv в i os разработке
 
Write cleaner, maintainable, and testable code in Android with MVVM
Write cleaner, maintainable, and testable code in Android with MVVMWrite cleaner, maintainable, and testable code in Android with MVVM
Write cleaner, maintainable, and testable code in Android with MVVM
 
iOS architecture patterns
iOS architecture patternsiOS architecture patterns
iOS architecture patterns
 
Mvc pattern and implementation in java fair
Mvc   pattern   and implementation   in   java fairMvc   pattern   and implementation   in   java fair
Mvc pattern and implementation in java fair
 
MVVM presentation
MVVM presentationMVVM presentation
MVVM presentation
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Introduction To MVVM
Introduction To MVVMIntroduction To MVVM
Introduction To MVVM
 
software architecture
software architecturesoftware architecture
software architecture
 
Models used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVMModels used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVM
 
MVVM in iOS presentation
MVVM in iOS presentationMVVM in iOS presentation
MVVM in iOS presentation
 
Android architectural components
Android architectural componentsAndroid architectural components
Android architectural components
 
iOS Coding Best Practices
iOS Coding Best PracticesiOS Coding Best Practices
iOS Coding Best Practices
 
Mvvm
MvvmMvvm
Mvvm
 
VIPER Architecture
VIPER ArchitectureVIPER Architecture
VIPER Architecture
 
Adopting MVVM
Adopting MVVMAdopting MVVM
Adopting MVVM
 

More from MobileMonday Estonia

Modern problems in backend engineering, Siim Kaspar Uustalu
Modern problems in backend engineering, Siim Kaspar UustaluModern problems in backend engineering, Siim Kaspar Uustalu
Modern problems in backend engineering, Siim Kaspar UustaluMobileMonday Estonia
 
Modern problems in backend engineering, Marten Meikop
Modern problems in backend engineering, Marten MeikopModern problems in backend engineering, Marten Meikop
Modern problems in backend engineering, Marten MeikopMobileMonday Estonia
 
Modern problems in backend engineering, Asko Tiidumaa
Modern problems in backend engineering, Asko TiidumaaModern problems in backend engineering, Asko Tiidumaa
Modern problems in backend engineering, Asko TiidumaaMobileMonday Estonia
 
Modern problems in backend engineering, Joel Mislav Kunst
Modern problems in backend engineering, Joel Mislav KunstModern problems in backend engineering, Joel Mislav Kunst
Modern problems in backend engineering, Joel Mislav KunstMobileMonday Estonia
 
Modern problems in backend engineering, Jüri Tarkpea
Modern problems in backend engineering, Jüri TarkpeaModern problems in backend engineering, Jüri Tarkpea
Modern problems in backend engineering, Jüri TarkpeaMobileMonday Estonia
 
Scientists meet Entrepreneurs - AI & Machine Learning, Mark Fishel, Institute...
Scientists meet Entrepreneurs - AI & Machine Learning, Mark Fishel, Institute...Scientists meet Entrepreneurs - AI & Machine Learning, Mark Fishel, Institute...
Scientists meet Entrepreneurs - AI & Machine Learning, Mark Fishel, Institute...MobileMonday Estonia
 
Scientists meet Entrepreneurs - AI & Machine Learning, Kristjan Korjus, Starship
Scientists meet Entrepreneurs - AI & Machine Learning, Kristjan Korjus, StarshipScientists meet Entrepreneurs - AI & Machine Learning, Kristjan Korjus, Starship
Scientists meet Entrepreneurs - AI & Machine Learning, Kristjan Korjus, StarshipMobileMonday Estonia
 
Scientists meet Entrepreneurs - AI & Machine Learning, Peeter Piksarv, Moonca...
Scientists meet Entrepreneurs - AI & Machine Learning, Peeter Piksarv, Moonca...Scientists meet Entrepreneurs - AI & Machine Learning, Peeter Piksarv, Moonca...
Scientists meet Entrepreneurs - AI & Machine Learning, Peeter Piksarv, Moonca...MobileMonday Estonia
 
Scientists meet Entrepreneurs - AI & Machine Learning, Tambet Matiisen, Unive...
Scientists meet Entrepreneurs - AI & Machine Learning, Tambet Matiisen, Unive...Scientists meet Entrepreneurs - AI & Machine Learning, Tambet Matiisen, Unive...
Scientists meet Entrepreneurs - AI & Machine Learning, Tambet Matiisen, Unive...MobileMonday Estonia
 
Scientists meet Entrepreneurs - AI & Machine Learning, Dima Fishman, Universi...
Scientists meet Entrepreneurs - AI & Machine Learning, Dima Fishman, Universi...Scientists meet Entrepreneurs - AI & Machine Learning, Dima Fishman, Universi...
Scientists meet Entrepreneurs - AI & Machine Learning, Dima Fishman, Universi...MobileMonday Estonia
 
Space Edition, Sven Lilla, ESA BIC
Space Edition, Sven Lilla, ESA BICSpace Edition, Sven Lilla, ESA BIC
Space Edition, Sven Lilla, ESA BICMobileMonday Estonia
 
Space Edition, Kadri Bussov, EST Cube
Space Edition, Kadri Bussov, EST CubeSpace Edition, Kadri Bussov, EST Cube
Space Edition, Kadri Bussov, EST CubeMobileMonday Estonia
 
Space Edition, Kalev Koppel, KappaZetta
Space Edition, Kalev Koppel, KappaZettaSpace Edition, Kalev Koppel, KappaZetta
Space Edition, Kalev Koppel, KappaZettaMobileMonday Estonia
 
Space Edition, Dr. Ali Nadir Arslan
Space Edition, Dr. Ali Nadir Arslan Space Edition, Dr. Ali Nadir Arslan
Space Edition, Dr. Ali Nadir Arslan MobileMonday Estonia
 
Product Marketing, Kair Käsper, Pipedrive
Product Marketing, Kair Käsper, PipedriveProduct Marketing, Kair Käsper, Pipedrive
Product Marketing, Kair Käsper, PipedriveMobileMonday Estonia
 
Product Marketing, Mattias Liivak, Fortumo
Product Marketing, Mattias Liivak, FortumoProduct Marketing, Mattias Liivak, Fortumo
Product Marketing, Mattias Liivak, FortumoMobileMonday Estonia
 
What Does it take to Develop Kickass Products?, Laura Noodapera
What Does it take to Develop Kickass Products?, Laura NoodaperaWhat Does it take to Develop Kickass Products?, Laura Noodapera
What Does it take to Develop Kickass Products?, Laura NoodaperaMobileMonday Estonia
 
What Does it take to Develop Kickass Products?, Britt Maasalu
What Does it take to Develop Kickass Products?, Britt MaasaluWhat Does it take to Develop Kickass Products?, Britt Maasalu
What Does it take to Develop Kickass Products?, Britt MaasaluMobileMonday Estonia
 
Meeting Female Entrepreneurs in Tech, Triinu Sirge
Meeting Female Entrepreneurs in Tech, Triinu SirgeMeeting Female Entrepreneurs in Tech, Triinu Sirge
Meeting Female Entrepreneurs in Tech, Triinu SirgeMobileMonday Estonia
 

More from MobileMonday Estonia (20)

Modern problems in backend engineering, Siim Kaspar Uustalu
Modern problems in backend engineering, Siim Kaspar UustaluModern problems in backend engineering, Siim Kaspar Uustalu
Modern problems in backend engineering, Siim Kaspar Uustalu
 
Modern problems in backend engineering, Marten Meikop
Modern problems in backend engineering, Marten MeikopModern problems in backend engineering, Marten Meikop
Modern problems in backend engineering, Marten Meikop
 
Modern problems in backend engineering, Asko Tiidumaa
Modern problems in backend engineering, Asko TiidumaaModern problems in backend engineering, Asko Tiidumaa
Modern problems in backend engineering, Asko Tiidumaa
 
Modern problems in backend engineering, Joel Mislav Kunst
Modern problems in backend engineering, Joel Mislav KunstModern problems in backend engineering, Joel Mislav Kunst
Modern problems in backend engineering, Joel Mislav Kunst
 
Modern problems in backend engineering, Jüri Tarkpea
Modern problems in backend engineering, Jüri TarkpeaModern problems in backend engineering, Jüri Tarkpea
Modern problems in backend engineering, Jüri Tarkpea
 
Scientists meet Entrepreneurs - AI & Machine Learning, Mark Fishel, Institute...
Scientists meet Entrepreneurs - AI & Machine Learning, Mark Fishel, Institute...Scientists meet Entrepreneurs - AI & Machine Learning, Mark Fishel, Institute...
Scientists meet Entrepreneurs - AI & Machine Learning, Mark Fishel, Institute...
 
Scientists meet Entrepreneurs - AI & Machine Learning, Kristjan Korjus, Starship
Scientists meet Entrepreneurs - AI & Machine Learning, Kristjan Korjus, StarshipScientists meet Entrepreneurs - AI & Machine Learning, Kristjan Korjus, Starship
Scientists meet Entrepreneurs - AI & Machine Learning, Kristjan Korjus, Starship
 
Scientists meet Entrepreneurs - AI & Machine Learning, Peeter Piksarv, Moonca...
Scientists meet Entrepreneurs - AI & Machine Learning, Peeter Piksarv, Moonca...Scientists meet Entrepreneurs - AI & Machine Learning, Peeter Piksarv, Moonca...
Scientists meet Entrepreneurs - AI & Machine Learning, Peeter Piksarv, Moonca...
 
Scientists meet Entrepreneurs - AI & Machine Learning, Tambet Matiisen, Unive...
Scientists meet Entrepreneurs - AI & Machine Learning, Tambet Matiisen, Unive...Scientists meet Entrepreneurs - AI & Machine Learning, Tambet Matiisen, Unive...
Scientists meet Entrepreneurs - AI & Machine Learning, Tambet Matiisen, Unive...
 
Scientists meet Entrepreneurs - AI & Machine Learning, Dima Fishman, Universi...
Scientists meet Entrepreneurs - AI & Machine Learning, Dima Fishman, Universi...Scientists meet Entrepreneurs - AI & Machine Learning, Dima Fishman, Universi...
Scientists meet Entrepreneurs - AI & Machine Learning, Dima Fishman, Universi...
 
Space Edition, Sven Lilla, ESA BIC
Space Edition, Sven Lilla, ESA BICSpace Edition, Sven Lilla, ESA BIC
Space Edition, Sven Lilla, ESA BIC
 
Space Edition, Kadri Bussov, EST Cube
Space Edition, Kadri Bussov, EST CubeSpace Edition, Kadri Bussov, EST Cube
Space Edition, Kadri Bussov, EST Cube
 
Space Edition, Kalev Koppel, KappaZetta
Space Edition, Kalev Koppel, KappaZettaSpace Edition, Kalev Koppel, KappaZetta
Space Edition, Kalev Koppel, KappaZetta
 
Space Edition, Dr. Ali Nadir Arslan
Space Edition, Dr. Ali Nadir Arslan Space Edition, Dr. Ali Nadir Arslan
Space Edition, Dr. Ali Nadir Arslan
 
Product Marketing, Kair Käsper, Pipedrive
Product Marketing, Kair Käsper, PipedriveProduct Marketing, Kair Käsper, Pipedrive
Product Marketing, Kair Käsper, Pipedrive
 
Product Marketing, Marelle Ellen
Product Marketing, Marelle EllenProduct Marketing, Marelle Ellen
Product Marketing, Marelle Ellen
 
Product Marketing, Mattias Liivak, Fortumo
Product Marketing, Mattias Liivak, FortumoProduct Marketing, Mattias Liivak, Fortumo
Product Marketing, Mattias Liivak, Fortumo
 
What Does it take to Develop Kickass Products?, Laura Noodapera
What Does it take to Develop Kickass Products?, Laura NoodaperaWhat Does it take to Develop Kickass Products?, Laura Noodapera
What Does it take to Develop Kickass Products?, Laura Noodapera
 
What Does it take to Develop Kickass Products?, Britt Maasalu
What Does it take to Develop Kickass Products?, Britt MaasaluWhat Does it take to Develop Kickass Products?, Britt Maasalu
What Does it take to Develop Kickass Products?, Britt Maasalu
 
Meeting Female Entrepreneurs in Tech, Triinu Sirge
Meeting Female Entrepreneurs in Tech, Triinu SirgeMeeting Female Entrepreneurs in Tech, Triinu Sirge
Meeting Female Entrepreneurs in Tech, Triinu Sirge
 

Recently uploaded

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 

Recently uploaded (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 

"iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade

  • 1. iOS: MVVMC MobileMonday 15 May 2017 Aleksandr Nikolajev iOS developer
  • 2. ME • Graduated as material scientist in University of Tartu • Joined Mooncascade in 2015 • FinTech, transportation, multimedia, sports, utilities
  • 3. AGENDA • Introduction to MVVMC and it’s pieces • Some examples • Unit testing
  • 4. • Tight coupling between View and Controller • Hard to test interactions between View and Controller • Model can be testable THE PROBLEM WITH APPLE’s MVC
  • 5. • An architecture pattern • Model - View - ViewModel - Coordinator • MVVMC treats UIViewController as a dumb presenter - just a view WHAT IS MVVMC ?
  • 6. HOW IT WORKS ? • Coordinator - owns View and/or another Coordinator(s), notifies Coordinator(s) • View - owns ViewModel, notifies ViewModel (e.g button tap) • ViewModel - owns Model, updates View, notifies Coordinator
  • 7. Model • Usually a protocol • C.R.U.D - Create, Read, Update, Delete • Uses functions, NOT properties • Injected into ViewModel
  • 8.
  • 9. ViewModel • Usually a class • Independent of UIKit • Injected into View and has no idea what the View is • Business logic • Operate with Model • Provide presentation data to view and notify if that data has changed • Communicate states to Coordinator
  • 10.
  • 11. Coordinator • Declared as a protocol • Handle navigation • Create View and inject ViewModel into it
  • 12.
  • 13. COMPLEX FLOWS • Many UIViewControllers • Many options to choose where to go • Does the UIViewController has to know what to show next?
  • 14.
  • 15.
  • 16. View • UIViewController is also a View !!! • Present human readable data • Do the layout • Inform ViewModel about interactions
  • 17.
  • 18. NOT ONLY UIViewController • There is no rule about using ViewModels only with UIViewController • You can use ViewModels on almost on every UI element • UITextField, UIButton, …
  • 19. NOT ONLY UIViewController • This will decrease your code lines in ViewModel • Makes code more distributed and increases reusability • Adds more flexibility to write unit tests
  • 20.
  • 21.
  • 22. HOW IT COMES TOGETHER? • The GOD — AppCoordinator • Only AppDelegate knows about AppCoordinator • Desides what to show when app is finished launching
  • 23.
  • 24.
  • 25. UNIT TESTING • ViewModel gets notified about events happened in the view - we can test what is the result • Test if presentation data is formatted correctly (e.g convert Date object into formatted date string) • Test if correct delegate method is called when it’s needed to move on with the flow • Test if errors are shown to view
  • 26. • Well distributed code • Good testability • Easy of use THE PROFIT
  • 27. • MVVM-C A simple way to navigate
 http://tech.trivago.com/2016/08/26/mvvm-c-a- simple-way-to-navigate • iOS Architecture Patterns
 https://medium.com/ios-os-x-development/ios- architecture-patterns-ecba4c38de52 REFERENCES
  • 29. If you wish to play with the code, clone this repo https://github.com/sasnik/MoMoMVVMC