mvvm pattern in xamarin - mvvmcross and xamarin.forms

19
MVVM pattern as a way of creating loosely coupled, maintainable and testable Xamarin apps Sylwester Wieczorkowski [email protected]

Upload: leawarecom

Post on 11-Jan-2017

718 views

Category:

Software


1 download

TRANSCRIPT

MVVMpatternasawayofcreatinglooselycoupled,maintainableandtestableXamarin apps

Sylwester [email protected]

Xamarin Platform

ü NativeUI,nativeAPIaccess,andnativeperformance

ü AnythingyoucandoinObjective-C,Swift,orJavayoucandoinC#withXamarin

ü Shipcutting-edgeappswithsame-daysupportfornewOSreleases

Xamarin TestCloud

ü Testsbehaveasusersdo–performingtaps,pinches,swipes,andmore

ü IntegrateswithCIforcontinuousautomatedtesting,testingappsoneverychange

ü Ensuresappslookandfeelexcellentwithfull-framescreenshotsandvideoplayback

Xamarin Insights+HockeyApp

ü Getmeaningfulcrashreportswiththemostreliablecrashreportingonthemarket

ü Seehowyourappisusedandwhatyourtestershavealreadycovered

ü Communicatewithyourusersandgetfeedback,supportrequests,andbugreportsfromwithinyourapp

SiloApproach

iOSApp

Objective-CXCode

AndroidApp

JavaAndroidStudio

WindowsApp

C#VisualStudio

TraditionalXamarin Approach

iOSC#UI AndroidC#UI WindowsC#UI

SharedC# Logic

TraditionalXamarin Approach

ü Appsthatrequirespecializedinteractions

ü Appswithhighlypolisheddesign

ü Appsthatusemanyplatform-specificAPIs

ü AppswherecustomUIismoreimportantthancodesharing

What’sMVVM?

View ViewModel Model

PresentationandPresentationLogic BusinessLogicandData

DataBinding

TraditionalXamarin Approach

v Createyourownframework

• SharedProject

• PortableClassLibrary

vUseanexistingMVVMsolution

• Bind

• MVVMLight

• ReactiveUI

• MvvmCross

ProjectStyles

DEMOMvvmCross

Belfius DirectMobile

Belfius DirectMobile

BNPParibasFortis

BNPParibasFortis

Xamarin.Forms Approach

SharedC# Logic

Xamarin.Forms - SharedC# UI

Xamarin.Forms Approach

ü Dataentryapps

ü Prototypesandproofs-of-concept

ü Appsthatrequirelittleplatform-specificfunctionality

ü AppswherecodesharingismoreimportantthancustomUI

Xamarin.Forms Approach

v Createyourownframework

• SticktoXamarin.Forms mechanisms(e.g.DependencyService,MessagingCenter)

• ImplementINotifyPropertyChangedandICommand

ProjectStyles

vUseanexistingMVVMsolution

• MugenMVVMToolkit

• MVVMLight

• FreshMvvm

• MvvmCross-Forms

• Prism

PrismforXamarin.Forms

ü MVVMSupport

ü Commanding

ü Messaging

ü Navigation

ü PageDialogService

ü Logging

ü DependencyInjection

DEMOPrism for Xamarin.Forms