KEMBAR78
Mvvm Pattern in Xamarin - MvvmCross and Xamarin.Forms | PDF
MVVM	pattern	as	a	way	of	creating	
loosely	coupled,	maintainable	and	
testable	Xamarin apps
Sylwester Wieczorkowski
sylwester.wieczorkowski@leaware.com
Xamarin Platform
ü Native	UI,	native	API	access,	
and	native	performance
ü Anything	you	can	do	in	
Objective-C,	Swift,	or	Java	you	
can	do	in	C#	with	Xamarin
ü Ship	cutting-edge	apps	with	
same-day	support	for	new	OS	
releases
Xamarin Test	Cloud
ü Tests	behave	as	users	do–
performing	taps,	pinches,	
swipes,	and	more
ü Integrates	with	CI	for	
continuous	automated	testing,	
testing	apps	on	every	change
ü Ensures	apps	look	and	feel	
excellent	with	full-frame	
screenshots	and	video	playback
Xamarin Insights	+	HockeyApp
ü Get	meaningful	crash	reports	
with	the	most	reliable	crash	
reporting	on	the	market
ü See	how	your	app	is	used	and	
what	your	testers	have	already	
covered
ü Communicate	with	your	users	
and	get	feedback,	support	
requests,	and	bug	reports	from	
within	your	app
Silo	Approach
iOS	App
Objective-C
XCode
Android	App
Java
Android	Studio
Windows	App
C#
Visual	Studio
Traditional	Xamarin Approach
iOS	C#	UI Android	C#	UI Windows	C#	UI
Shared	C# Logic
Traditional	Xamarin Approach
ü Apps	that	require	specialized	interactions
ü Apps	with	highly	polished	design
ü Apps	that	use	many	platform-specific	APIs
ü Apps	where	custom	UI	is	more	important	than	code	sharing
What’s	MVVM?
View ViewModel Model
Presentation	and	Presentation	Logic Business	Logic	and	Data
Data	Binding
Traditional	Xamarin Approach
v Create	your	own	framework
• Shared	Project
• Portable	Class	Library
v Use	an	existing	MVVM	solution
• Bind
• MVVM	Light
• ReactiveUI
• MvvmCross
Project	Styles
DEMOMvvmCross
Belfius Direct	Mobile
Belfius Direct	Mobile
BNP	Paribas	Fortis
BNP	Paribas	Fortis
Xamarin.Forms Approach
Shared	C# Logic
Xamarin.Forms - Shared	C# UI
Xamarin.Forms Approach
ü Data	entry	apps
ü Prototypes	and	proofs-of-concept
ü Apps	that	require	little	platform-specific	functionality
ü Apps	where	code	sharing	is	more	important	than	custom	UI
Xamarin.Forms Approach
v Create	your	own	framework
• Stick	to	Xamarin.Forms mechanisms
(e.g.	DependencyService,	
MessagingCenter)
• Implement	INotifyPropertyChanged
and	ICommand
Project	Styles
v Use	an	existing	MVVM	solution
• Mugen MVVM	Toolkit
• MVVM	Light
• FreshMvvm
• MvvmCross-Forms
• Prism
Prism	for	Xamarin.Forms
ü MVVM	Support
ü Commanding
ü Messaging
ü Navigation
ü Page	Dialog	Service
ü Logging
ü Dependency	Injection
DEMOPrism for Xamarin.Forms

Mvvm Pattern in Xamarin - MvvmCross and Xamarin.Forms