June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Going	pixel	perfect	with	
Xamarin &	MvvmCross
Nicolas	Milcoff
COO	/	Mobile	Lead
DGenix
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Agenda
• Introduction
• Xamarin Platform:	Architecture	approaches
• Traditional	Xamarin:	What	does	it	look	like?
• MVVM	pattern
• Polished,	pixel	perfect	apps	with	MvvmCross
• Demo
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Introduction
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
What	are	the	challenges	of	the	
mobile	ecosystem?
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Mobile	app	challenges
• Device	fragmentation
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Mobile	app	challenges
• Technical	complexity
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Mobile	app	challenges
• Fast	release	cycle
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Mobile	app	challenges
• Short,	imperative,	rich	sessions
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Mobile	app	challenges
• High	expectations	and	aggressive	competition
60%	of	users	will	abandon	an	app	if	it	doesn’t	
load	within	3	seconds
43%	of	those	users	said	they	would	never	
return	to	the	app
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Xamarin Platform:	Architecture	
approaches
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Xamarin App	Architectures
Shared App	logic (C#)
UI	platform code (C#)
Traditional Xamarin
Shared App	logic (C#)
UI	platform code (C#)
Xamarin.Forms
Xamarin.Forms abstraction
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Xamarin !=	Xamarin.Forms
Xamarin
Xamarin.Forms
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
When	to	use	Xamarin.Forms
• Prototyping
• Data	entry	apps
• Apps	that	don’t	make	extensive	use	of	platform	APIs
• Apps	for	internal	usage
• Apps	with	limited	and	well	known	scopes
“The	team	already	knows	C#	and	.xaml” is	not	a	fair	
reason	to	use	Xamarin.Forms
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
When	to	use	Traditional	Xamarin
• Apps	with	polished	designs
• Apps	that	will	scale	over	time
• Apps	for	end	users
• Apps	that	make	extensive	use	of	platform	APIs
• Apps	where	being	up-to-date	on	each	device	OS	releases	is	important
• Apps	that	manage	big	quantities	of	data	(>	30	controls	in	screen)
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Traditional	Xamarin:	What	does	it	look	
like?
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Typical	solution	structure
Shared code in	format of	a	
Portable	Class Library,	
Shared Project	or .Net
Standard	Library.
An application project for each
target	platform.
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
What’s	in	the	shared	code?
Everything	but	the	UI:
• Models
• Constants
• Local	storage	management
• Business	logic
• REST	client
• Dependency	services	abstractions
• Ready	made	plugins	(camera,	gallery,	location,	sound,	settings)
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
What’s	in	each	application	project	code?
• UI	definition
• Dependency	services	implementations
• Platform	config files	(AndroidManifest,	Info.plist,	…)
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
MVVM	pattern
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
MVVM	architecture	pattern
Model
1.	Action	
(command)
4.	Notify	
change
3.	Access	
data
2.	Process	
logic
ViewModelView
Button
Text
5.	Change	
data
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Polished,	pixel	perfect	apps	with	
MvvmCross
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
MvvmCross
• Most	advanced	MVVM	framework	for	Xamarin	and	.Net.
• Currently	supports	Xamarin.iOS, Xamarin.Android,	Xamarin.Mac,	
Xamarin.tvOS,	Xamarin.Forms,	UWP and	WPF.
• Community	driven:	Over	180	contributors.
• Fast	release	cycle:	once	a	month.
• More	than	5000	companies	rely	on	this	framework.
www.mvvmcross.com
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Why	use	an	OS	MVVM	framework?
• Resolves	most	abstraction	discussions
• Built-in	features
• Provides	a	standard	“way	to	do”	things
• Time	saving
• Enterprise	ready
• Customization
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Miguel de Icaza
Xamarin CTO
Scott Hanselman
Microsoft Developer
Evangelist
I love
MvvmCross
I am really
impressed
with
MvvmCross
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Main	features
• MVVM	architecture	pattern
• Data	Binding	and	Value	Converters
• Inversion	of	Control	container	and	Dependency	Injection	engine
• Navigation	system	(ViewModel to	ViewModel navigation)
• Platform	specifics	support
• Unit	test	helpers
• Lots	of	plugins
• Complete	flexibility!
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Library	compatibility
Xamarin.Forms
ReactiveUI
ReactiveX
SkiaSharp
FFImageLoading
Async/Await
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Views	navigation	with	MvvmCross
FirstViewModel SecondViewModel
Shared code
Navigate()
FirstView to	SecondView navigation
FirstView to	SecondView navigation
ViewPresenter
ViewPresenter
Platforms
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Views	navigation	with	MvvmCross
• All	navigation	logic	is	performed	in	the	shared	code
• There	is	a	ViewPresenter for	each	platform
• A	ViewPresenter is	responsible	for	indicating	how	a	View	should	be	
displayed
• Presentation	hints	can	be	sent	from	shared	code	(clear	backstack,	
close	View,	…)
• MvvmCross provides	default	presenters	for	most	use	cases
• ViewPresenters can	be	easily	extended
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Build	rich	UIs	using	native	tools
• Data	Bindings	support	for	.axml/.xml/.xaml files
• Storyboards/XIB	support
• Controls	provided	by	MvvmCross to	accelerate	process
• Differentiate	layouts	for	each	platform
• High	performance
• Happy	users	with	common	controls	and	patterns
• Still	share	more	than	50%	of	code!
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Demo	recap
• App	built	for	Android	&	iOS
• Customized	layouts	for	each	platform
• Xamarin traditional	+	MvvmCross =	>	60%	code	shared
• Interactions	View	->	ViewModel and	ViewModel ->	View
• Fast	UI	development	with	MvvmCross controls
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
MvvmCross support
Get help on Slack
xamarinchat.herokuapp.com
#MvvmCross channel
Follow influencers
#MvvmCross
@MvvmCross
Support MvvmCross!
Opencollective.com/mvvmcross
Join the LinkedIn group
linkedin.com/groups/8456977
MvvmCross & Xamarin group
Contribute on Github
Github.com/MvvmCross/MvvmCross
June	29th,	30th &	July	1st 2017.NET	Conf AR v2017
Thank	you!	:)
http://nmilcoff.com
@nmilcoff
nicolas.milcoff@d-genix.com
Nicolas	Milcoff

Going pixel perfect with Xamarin and MvvmCross

  • 1.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Going pixel perfect with Xamarin & MvvmCross Nicolas Milcoff COO / Mobile Lead DGenix
  • 2.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Agenda • Introduction • Xamarin Platform: Architecture approaches • Traditional Xamarin: What does it look like? • MVVM pattern • Polished, pixel perfect apps with MvvmCross • Demo
  • 3.
  • 4.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 What are the challenges of the mobile ecosystem?
  • 5.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Mobile app challenges • Device fragmentation
  • 6.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Mobile app challenges • Technical complexity
  • 7.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Mobile app challenges • Fast release cycle
  • 8.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Mobile app challenges • Short, imperative, rich sessions
  • 9.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Mobile app challenges • High expectations and aggressive competition 60% of users will abandon an app if it doesn’t load within 3 seconds 43% of those users said they would never return to the app
  • 10.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Xamarin Platform: Architecture approaches
  • 11.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Xamarin App Architectures Shared App logic (C#) UI platform code (C#) Traditional Xamarin Shared App logic (C#) UI platform code (C#) Xamarin.Forms Xamarin.Forms abstraction
  • 12.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Xamarin != Xamarin.Forms Xamarin Xamarin.Forms
  • 13.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 When to use Xamarin.Forms • Prototyping • Data entry apps • Apps that don’t make extensive use of platform APIs • Apps for internal usage • Apps with limited and well known scopes “The team already knows C# and .xaml” is not a fair reason to use Xamarin.Forms
  • 14.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 When to use Traditional Xamarin • Apps with polished designs • Apps that will scale over time • Apps for end users • Apps that make extensive use of platform APIs • Apps where being up-to-date on each device OS releases is important • Apps that manage big quantities of data (> 30 controls in screen)
  • 15.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Traditional Xamarin: What does it look like?
  • 16.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Typical solution structure Shared code in format of a Portable Class Library, Shared Project or .Net Standard Library. An application project for each target platform.
  • 17.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 What’s in the shared code? Everything but the UI: • Models • Constants • Local storage management • Business logic • REST client • Dependency services abstractions • Ready made plugins (camera, gallery, location, sound, settings)
  • 18.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 What’s in each application project code? • UI definition • Dependency services implementations • Platform config files (AndroidManifest, Info.plist, …)
  • 19.
  • 20.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 MVVM architecture pattern Model 1. Action (command) 4. Notify change 3. Access data 2. Process logic ViewModelView Button Text 5. Change data
  • 21.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Polished, pixel perfect apps with MvvmCross
  • 22.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 MvvmCross • Most advanced MVVM framework for Xamarin and .Net. • Currently supports Xamarin.iOS, Xamarin.Android, Xamarin.Mac, Xamarin.tvOS, Xamarin.Forms, UWP and WPF. • Community driven: Over 180 contributors. • Fast release cycle: once a month. • More than 5000 companies rely on this framework. www.mvvmcross.com
  • 23.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Why use an OS MVVM framework? • Resolves most abstraction discussions • Built-in features • Provides a standard “way to do” things • Time saving • Enterprise ready • Customization
  • 24.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Miguel de Icaza Xamarin CTO Scott Hanselman Microsoft Developer Evangelist I love MvvmCross I am really impressed with MvvmCross
  • 25.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Main features • MVVM architecture pattern • Data Binding and Value Converters • Inversion of Control container and Dependency Injection engine • Navigation system (ViewModel to ViewModel navigation) • Platform specifics support • Unit test helpers • Lots of plugins • Complete flexibility!
  • 26.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Library compatibility Xamarin.Forms ReactiveUI ReactiveX SkiaSharp FFImageLoading Async/Await
  • 27.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Views navigation with MvvmCross FirstViewModel SecondViewModel Shared code Navigate() FirstView to SecondView navigation FirstView to SecondView navigation ViewPresenter ViewPresenter Platforms
  • 28.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Views navigation with MvvmCross • All navigation logic is performed in the shared code • There is a ViewPresenter for each platform • A ViewPresenter is responsible for indicating how a View should be displayed • Presentation hints can be sent from shared code (clear backstack, close View, …) • MvvmCross provides default presenters for most use cases • ViewPresenters can be easily extended
  • 29.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Build rich UIs using native tools • Data Bindings support for .axml/.xml/.xaml files • Storyboards/XIB support • Controls provided by MvvmCross to accelerate process • Differentiate layouts for each platform • High performance • Happy users with common controls and patterns • Still share more than 50% of code!
  • 30.
  • 31.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Demo recap • App built for Android & iOS • Customized layouts for each platform • Xamarin traditional + MvvmCross = > 60% code shared • Interactions View -> ViewModel and ViewModel -> View • Fast UI development with MvvmCross controls
  • 32.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 MvvmCross support Get help on Slack xamarinchat.herokuapp.com #MvvmCross channel Follow influencers #MvvmCross @MvvmCross Support MvvmCross! Opencollective.com/mvvmcross Join the LinkedIn group linkedin.com/groups/8456977 MvvmCross & Xamarin group Contribute on Github Github.com/MvvmCross/MvvmCross
  • 33.
    June 29th, 30th & July 1st 2017.NET ConfAR v2017 Thank you! :) http://nmilcoff.com @nmilcoff nicolas.milcoff@d-genix.com Nicolas Milcoff