SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
Making your native apps
even more cross-platform
using MVVM
Jim Bennett
Mobile Developer at EROAD
@JimBobBennett
https://JimBobBennett.io
https://github.com/jimbobbennett
Author of Xamarin in Action
Learn how to build production-quality Xamarin apps using MVVM
to increase the amount of cross-platform code
Now available as part of the Manning Early Access Program
http://xam.jbb.io
Why do we use Xamarin?
Common languages and
framework
Code can be shared across
platforms
Xamarin Cross-Platform apps
• Xamarin apps are native apps
• Code written using the core libraries
can be shared across all platforms
using PCLs
• Only the platform specific stuff is not
cross platform
MVVM increases the amount of
testable shared code in your apps
Example - TipCalc
Business logic - in shared
code in a PCL
public class TipCalculator

{

public decimal Calculate(decimal amount) !=> amount*0.15m;

}

UI - in platform-specific code
in iOS/Android app projects
UI is wired up to business
logic in platform-specific code
!// Android

Calculate.Click += (s, e) !=>

{

var amount = Convert.ToDecimal(BillAmount.Text);

TipAmount.Text = _tipCalculator.Calculate(amount).ToString("C2");

};



Calculate.Enabled = false;

BillAmount.TextChanged += (s, e) !=> Calculate.Enabled = !string.IsNullOrEmpty(BillAmount.Text);

!// iOS

Calculate.TouchUpInside += (s, e) !=>

{

var amount = Convert.ToDecimal(BillAmount.Text);

TipAmount.Text = _tipCalculator.Calculate(amount).ToString("C2");

};



Calculate.Enabled = false;

BillAmount.AddTarget((s, e) !=> Calculate.Enabled = !string.IsNullOrEmpty(BillAmount.Text), 

UIControlEvent.EditingChanged);

Only the business logic can
be unit tested
Only the business logic is
cross-platform
The more cross-platform
code the better
MVVM FTW!
What is MVVM?
• Design pattern used for building UI
based apps - originally invented by
Microsoft for WPF
• Model is business logic
• View is pure UI, no logic
• View Model is UI logic
• Binding wires up view to view model
Model layer is business logic
• Written using cross-platform code
• Can be unit tested
• TipCalculator would be part of the model layer
View layer is pure UI
• Written using platform-specific code
• Cannot be unit tested
• iOS ViewController/Storyboard and Android
Activity/layout would be part of the view layer
ViewModel layer and bindings
are where all the magic is
Each view is backed by a
view model
TipCalcView
public class TipCalcViewModel :
INotifyPropertyChanged

{

!!...

}
TipCalcViewModel
State comes from properties
• When these properties change an event is raised
• The binding layer listens to this event and updates
the UI
• Can be used for data, or properties that define the
UI
• Value converters can be used to change the type
Behaviour comes from
commands
• Commands are objects that wrap actions
• Commands can control if they can be executed
• The binding layer listens to UI events and executes
commands
• If the commands cannot be execute the binding
layer can update the UI to reflect this
View models can also handle
navigation
• Each view has one view model
• Navigation is from view model to view model
• The MVVM framework finds the right view for a
view model and shows it
Xamarin Cross-Platform apps
with MVVM
• Business logic and UI logic can be in
platform specific code
• Commands and property notifications
provide a cross-platform way to
interact with the UI
• Some application logic is shared
• Less platform specific code
Demo time!
MVVM Frameworks
What about Xamarin
Forms?
Xamarin Forms was
built for MVVM!
MVVM increases the amount of
testable shared code in your apps
Jim Bennett
Mobile Application Developer at EROAD
@JimBobBennett
https://JimBobBennett.io
Sample code at:
https://github.com/jimbobbennett/CrossPlatformSummit
Author of Xamarin in Action
Learn how to build production-quality Xamarin apps using MVVM
to increase the amount of cross-platform code
Now available as part of the Manning Early Access Program
http://xam.jbb.io

Contenu connexe

Tendances

Building hybrid apps with Xamarin, Ryan Paul
Building hybrid apps with Xamarin, Ryan PaulBuilding hybrid apps with Xamarin, Ryan Paul
Building hybrid apps with Xamarin, Ryan Paul
Xamarin
 

Tendances (20)

Say hello to Xamarin 3
Say hello to Xamarin 3Say hello to Xamarin 3
Say hello to Xamarin 3
 
Native App Development for iOS, Android, and Windows with Visual Studio
Native App Development for iOS, Android, and Windows with Visual StudioNative App Development for iOS, Android, and Windows with Visual Studio
Native App Development for iOS, Android, and Windows with Visual Studio
 
Cross-platform Mobile Development
Cross-platform Mobile DevelopmentCross-platform Mobile Development
Cross-platform Mobile Development
 
C# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform developmentC# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform development
 
Universal Windows Platform
Universal Windows PlatformUniversal Windows Platform
Universal Windows Platform
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile Development
 
Building hybrid apps with Xamarin, Ryan Paul
Building hybrid apps with Xamarin, Ryan PaulBuilding hybrid apps with Xamarin, Ryan Paul
Building hybrid apps with Xamarin, Ryan Paul
 
Cross Platform Development with Xamarin
Cross Platform Development with XamarinCross Platform Development with Xamarin
Cross Platform Development with Xamarin
 
Xamarin Platform
Xamarin PlatformXamarin Platform
Xamarin Platform
 
An introduction to Xamarin
An introduction to XamarinAn introduction to Xamarin
An introduction to Xamarin
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4
 
Intro to Building Mobile Apps with Xamarin
Intro to Building Mobile Apps with XamarinIntro to Building Mobile Apps with Xamarin
Intro to Building Mobile Apps with Xamarin
 
Developing and Designing Native Mobile Apps in Visual Studio
Developing and Designing Native Mobile Apps in Visual StudioDeveloping and Designing Native Mobile Apps in Visual Studio
Developing and Designing Native Mobile Apps in Visual Studio
 
Xamarin.Forms
Xamarin.FormsXamarin.Forms
Xamarin.Forms
 
Cross platform development with c# and xamarin
Cross platform development with c# and xamarinCross platform development with c# and xamarin
Cross platform development with c# and xamarin
 
Cross Platform Mobile Development with C# and Xamarin
Cross Platform Mobile Development with C# and XamarinCross Platform Mobile Development with C# and Xamarin
Cross Platform Mobile Development with C# and Xamarin
 
Hitchhicker's Guide to Using Xamarin Forms with RESTful Services
Hitchhicker's Guide to Using Xamarin Forms with RESTful ServicesHitchhicker's Guide to Using Xamarin Forms with RESTful Services
Hitchhicker's Guide to Using Xamarin Forms with RESTful Services
 
Hybrid Mobile Development
Hybrid Mobile DevelopmentHybrid Mobile Development
Hybrid Mobile Development
 
Smaller Not Taller: Defeating the mobile application architecture giant
Smaller Not Taller: Defeating the mobile application architecture giantSmaller Not Taller: Defeating the mobile application architecture giant
Smaller Not Taller: Defeating the mobile application architecture giant
 
Building Your First Android App with Xamarin
Building Your First Android App with XamarinBuilding Your First Android App with Xamarin
Building Your First Android App with Xamarin
 

En vedette

Cross platform mobile developement introduction
Cross platform mobile developement   introductionCross platform mobile developement   introduction
Cross platform mobile developement introduction
Marcel de Vries
 
Cross Platform Mobile Development with Xamarin
Cross Platform Mobile Development with XamarinCross Platform Mobile Development with Xamarin
Cross Platform Mobile Development with Xamarin
bryan costanich
 

En vedette (12)

Building Quality Cross-Platform Apps with Xamarin
Building Quality Cross-Platform Apps with XamarinBuilding Quality Cross-Platform Apps with Xamarin
Building Quality Cross-Platform Apps with Xamarin
 
CONCEPTO DE INFORMATICA
CONCEPTO DE INFORMATICACONCEPTO DE INFORMATICA
CONCEPTO DE INFORMATICA
 
Important Things Of Boot Camp
Important Things Of Boot CampImportant Things Of Boot Camp
Important Things Of Boot Camp
 
Mobile first ux
Mobile first uxMobile first ux
Mobile first ux
 
03 cross platform design
03 cross platform design03 cross platform design
03 cross platform design
 
IBM MobileFirst - Hybrid App Development
IBM MobileFirst - Hybrid App DevelopmentIBM MobileFirst - Hybrid App Development
IBM MobileFirst - Hybrid App Development
 
Cross platform mobile developement introduction
Cross platform mobile developement   introductionCross platform mobile developement   introduction
Cross platform mobile developement introduction
 
Most Popular Cross Platform Mobile Development Tools
Most Popular Cross Platform Mobile Development ToolsMost Popular Cross Platform Mobile Development Tools
Most Popular Cross Platform Mobile Development Tools
 
Synapse india reviews on mobile application development
Synapse india reviews on mobile application developmentSynapse india reviews on mobile application development
Synapse india reviews on mobile application development
 
Cross Platform Mobile Development with Xamarin
Cross Platform Mobile Development with XamarinCross Platform Mobile Development with Xamarin
Cross Platform Mobile Development with Xamarin
 
Cross Platform Mobile Application Development Using Xamarin and C#
Cross Platform Mobile Application Development Using Xamarin and C#Cross Platform Mobile Application Development Using Xamarin and C#
Cross Platform Mobile Application Development Using Xamarin and C#
 
360 Flex Atlanta
360 Flex Atlanta360 Flex Atlanta
360 Flex Atlanta
 

Similaire à Cross platform Xamarin Apps With MVVM

Similaire à Cross platform Xamarin Apps With MVVM (20)

Diving Into Xamarin.Forms
Diving Into Xamarin.Forms Diving Into Xamarin.Forms
Diving Into Xamarin.Forms
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin forms
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Xamarin.Forms Advanced Topics
Xamarin.Forms Advanced TopicsXamarin.Forms Advanced Topics
Xamarin.Forms Advanced Topics
 
Automatic code generation for cross platform, multi-device mobile apps. An in...
Automatic code generation for cross platform, multi-device mobile apps. An in...Automatic code generation for cross platform, multi-device mobile apps. An in...
Automatic code generation for cross platform, multi-device mobile apps. An in...
 
Building xamarin.forms apps with prism and mvvm
Building xamarin.forms apps with prism and mvvmBuilding xamarin.forms apps with prism and mvvm
Building xamarin.forms apps with prism and mvvm
 
Why is xamarin the preferred app development platform among app developers
Why is xamarin the preferred app development platform among app developersWhy is xamarin the preferred app development platform among app developers
Why is xamarin the preferred app development platform among app developers
 
Lecture 08 Xamarin
Lecture 08 XamarinLecture 08 Xamarin
Lecture 08 Xamarin
 
Xamarin介紹
Xamarin介紹Xamarin介紹
Xamarin介紹
 
Building databound JavaScript apps with Knockoutjs
Building databound JavaScript apps with KnockoutjsBuilding databound JavaScript apps with Knockoutjs
Building databound JavaScript apps with Knockoutjs
 
Dia 4.1 mvvm cross
Dia 4.1   mvvm crossDia 4.1   mvvm cross
Dia 4.1 mvvm cross
 
Building Cross-Platform JavaScript Apps using Cordova
Building Cross-Platform JavaScript Apps using CordovaBuilding Cross-Platform JavaScript Apps using Cordova
Building Cross-Platform JavaScript Apps using Cordova
 
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCrossC# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
 
Introduction to xamarin
Introduction to xamarinIntroduction to xamarin
Introduction to xamarin
 
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
 
Xamarin Development
Xamarin DevelopmentXamarin Development
Xamarin Development
 
SpringCloudConfig.pptx.pdf
SpringCloudConfig.pptx.pdfSpringCloudConfig.pptx.pdf
SpringCloudConfig.pptx.pdf
 
Prism library and MVVM
Prism library and MVVMPrism library and MVVM
Prism library and MVVM
 
Xamarin in real life: our MVP approach - Daniele Leombruni Antonino Cacace - ...
Xamarin in real life: our MVP approach - Daniele Leombruni Antonino Cacace - ...Xamarin in real life: our MVP approach - Daniele Leombruni Antonino Cacace - ...
Xamarin in real life: our MVP approach - Daniele Leombruni Antonino Cacace - ...
 
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCrossC# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
 

Plus de Jim Bennett

Plus de Jim Bennett (10)

Intro to the Cloud from TeenHacks LI
Intro to the Cloud from TeenHacks LIIntro to the Cloud from TeenHacks LI
Intro to the Cloud from TeenHacks LI
 
WooHoo my app is on the store! Now what?
WooHoo my app is on the store! Now what?WooHoo my app is on the store! Now what?
WooHoo my app is on the store! Now what?
 
Building Fabulous mobile apps with F#
Building Fabulous mobile apps with F#Building Fabulous mobile apps with F#
Building Fabulous mobile apps with F#
 
Adding platform specific magic to cross-platform Xamarin Forms apps
Adding platform specific magic to cross-platform Xamarin Forms appsAdding platform specific magic to cross-platform Xamarin Forms apps
Adding platform specific magic to cross-platform Xamarin Forms apps
 
Learning to love f#
Learning to love f#Learning to love f#
Learning to love f#
 
App center - the gateway drug to mobile devops
App center -  the gateway drug to mobile devopsApp center -  the gateway drug to mobile devops
App center - the gateway drug to mobile devops
 
Adding platform specific magic to cross-platform Xamarin Forms apps
Adding platform specific magic to cross-platform Xamarin Forms appsAdding platform specific magic to cross-platform Xamarin Forms apps
Adding platform specific magic to cross-platform Xamarin Forms apps
 
Clicking on the real world with iBeacon and eddystone
Clicking on the real world with iBeacon and eddystoneClicking on the real world with iBeacon and eddystone
Clicking on the real world with iBeacon and eddystone
 
IBeacons and Eddystone
IBeacons and EddystoneIBeacons and Eddystone
IBeacons and Eddystone
 
Xamarin iBeacon Mini-hack using Estimote iBeacons
Xamarin iBeacon Mini-hack using Estimote iBeaconsXamarin iBeacon Mini-hack using Estimote iBeacons
Xamarin iBeacon Mini-hack using Estimote iBeacons
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Cross platform Xamarin Apps With MVVM

  • 1. Making your native apps even more cross-platform using MVVM
  • 2. Jim Bennett Mobile Developer at EROAD @JimBobBennett https://JimBobBennett.io https://github.com/jimbobbennett
  • 3. Author of Xamarin in Action Learn how to build production-quality Xamarin apps using MVVM to increase the amount of cross-platform code Now available as part of the Manning Early Access Program http://xam.jbb.io
  • 4. Why do we use Xamarin?
  • 6. Code can be shared across platforms
  • 7. Xamarin Cross-Platform apps • Xamarin apps are native apps • Code written using the core libraries can be shared across all platforms using PCLs • Only the platform specific stuff is not cross platform
  • 8. MVVM increases the amount of testable shared code in your apps
  • 10. Business logic - in shared code in a PCL public class TipCalculator
 {
 public decimal Calculate(decimal amount) !=> amount*0.15m;
 }

  • 11. UI - in platform-specific code in iOS/Android app projects
  • 12. UI is wired up to business logic in platform-specific code !// Android
 Calculate.Click += (s, e) !=>
 {
 var amount = Convert.ToDecimal(BillAmount.Text);
 TipAmount.Text = _tipCalculator.Calculate(amount).ToString("C2");
 };
 
 Calculate.Enabled = false;
 BillAmount.TextChanged += (s, e) !=> Calculate.Enabled = !string.IsNullOrEmpty(BillAmount.Text);
 !// iOS
 Calculate.TouchUpInside += (s, e) !=>
 {
 var amount = Convert.ToDecimal(BillAmount.Text);
 TipAmount.Text = _tipCalculator.Calculate(amount).ToString("C2");
 };
 
 Calculate.Enabled = false;
 BillAmount.AddTarget((s, e) !=> Calculate.Enabled = !string.IsNullOrEmpty(BillAmount.Text), 
 UIControlEvent.EditingChanged);

  • 13. Only the business logic can be unit tested
  • 14. Only the business logic is cross-platform
  • 17. What is MVVM? • Design pattern used for building UI based apps - originally invented by Microsoft for WPF • Model is business logic • View is pure UI, no logic • View Model is UI logic • Binding wires up view to view model
  • 18. Model layer is business logic • Written using cross-platform code • Can be unit tested • TipCalculator would be part of the model layer
  • 19. View layer is pure UI • Written using platform-specific code • Cannot be unit tested • iOS ViewController/Storyboard and Android Activity/layout would be part of the view layer
  • 20. ViewModel layer and bindings are where all the magic is
  • 21. Each view is backed by a view model TipCalcView public class TipCalcViewModel : INotifyPropertyChanged
 {
 !!...
 } TipCalcViewModel
  • 22. State comes from properties • When these properties change an event is raised • The binding layer listens to this event and updates the UI • Can be used for data, or properties that define the UI • Value converters can be used to change the type
  • 23. Behaviour comes from commands • Commands are objects that wrap actions • Commands can control if they can be executed • The binding layer listens to UI events and executes commands • If the commands cannot be execute the binding layer can update the UI to reflect this
  • 24. View models can also handle navigation • Each view has one view model • Navigation is from view model to view model • The MVVM framework finds the right view for a view model and shows it
  • 25. Xamarin Cross-Platform apps with MVVM • Business logic and UI logic can be in platform specific code • Commands and property notifications provide a cross-platform way to interact with the UI • Some application logic is shared • Less platform specific code
  • 30. MVVM increases the amount of testable shared code in your apps
  • 31. Jim Bennett Mobile Application Developer at EROAD @JimBobBennett https://JimBobBennett.io Sample code at: https://github.com/jimbobbennett/CrossPlatformSummit
  • 32. Author of Xamarin in Action Learn how to build production-quality Xamarin apps using MVVM to increase the amount of cross-platform code Now available as part of the Manning Early Access Program http://xam.jbb.io