building real world apps with xamarin.forms

Post on 16-Jul-2015

593 Views

Category:

Mobile

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

www.xam-consulting.com www.michaelridland.commichael@xam-consulting.com

Building ‘real-world’ apps

with Xamarin.Forms

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Michael Ridland

Xamarin Consultant / Founder

@ Xam Consulting (xam-consulting.com)

Xamarin Specialists - We work with Xamarin

all day and night.

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Developed Apps WITHOUT Xamarin.Forms

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Developed Apps WITH Xamarin.Forms

www.xam-consulting.com www.michaelridland.commichael@xam-consulting.com

My experiences and tips.

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Good Parts

Fast and Easy (Generally)

good features/extensibility points - custom renderers,

message centre etc.

Anything you can do in a Native app you can do in

Xamarin.Forms

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Not Good Parts

At the moment it still stuffers from common denominator. e.g.

Save and Cancel are different on Android, iOS and WP.

The coverage of UI elements isn’t huge

Tiny Cuts - No Bordering, Padding, Radius, ToolBarButtons only

on rightside, Only TapGestureRegonizers, Picker not databound

Missing extensibility points, when tapping into Framework (unless

you do a fully custom page/viewcontroller)

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Don’t fight the Framework

‘I want Cancel here because that’s how I do it in iOS’…

‘I want swipe cell because that’s how I do it in iOS’…

If you use Xamarin.Forms, try not to bring in pre conceptions of how you

want your UI to be. You can build nice UI’s with Xamarin.Forms but you

just need to be within it’s constraints and no swipe cells.

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Don’t fight the Framework

33,000

.NET

BIG? 40,000 (Forms)4,000+

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Don’t fight the Framework

It’s 3-10 times more expensive

but you can still do anything that you can do in Native

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Style with StackLayout and BoxView

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Prototype

• Prototype your app in Xamarin.Forms.. see if it’s going to work…

• Traditional Xamarin.iOS and Xamarin.Android is still great if you want a

amazing experience on all platforms.

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - MessagingCentre

• Publish/Subscribe

• Great for communicating between different parts of app, especially

between the Forms API and Native API

• Don’t overdo it (can be abused like a goto statement)

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Device.StartTimer

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Bindable Property Code Template

public static readonly BindableProperty $Name$Property

= BindableProperty.Create<$owner$, $type$>(p => p.$Name$, default($type$));

public $type$ $Name$ {

get { return ($type$)GetValue($Name$Property); }

set { SetValue($Name$Property, value); }

}

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Use a Mvvm

Preferable one with a Convention over Configuration.

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Layer Views using AbsoluteLayout

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Easy dialogs with Acr-Xamarin-Forms

Easily add Alerts/Prompts/Loading Dialogs using Acr

(https://github.com/aritchie/acr-xamarin-forms)

- It’s in nuget

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Fill the gaps with Xamarin.Forms.Labs

What else is there?

- More UI elements

- HybridWebView can be useful when used with Razor!

- INetwork service get the InternetConnectionStatus (WIFI)?

- Photo library/take a photo

- Extended TextFields - Fonts and Border properties

- + More

www.xam-consulting.com www.michaelridland.commichael@xam-consulting.com

Labs Demo

Warning - Don’t try labs on your first day.

Warning 2 - It can be broken and part implemented

michael@xam-consulting.com www.xam-consulting.com www.michaelridland.com

Tip - Use the Source

Xamarin.Forms Source (Can use Assembly browser in XS)

XLabs Source

* The #1 documentation for Custom Renderers!

www.xam-consulting.com www.michaelridland.commichael@xam-consulting.com

Yes! (Probably)

There’s some sucky parts, but it’s still better than every other option.

Should I use Xamarin.Forms?

www.xam-consulting.com www.michaelridland.commichael@xam-consulting.com

Tip - Hire Me ;) - www.michaelridland.com

All your pain goes away ….

www.xam-consulting.com www.michaelridland.commichael@xam-consulting.com

Live Coding - Rolling your own Mvvm

www.xam-consulting.com www.michaelridland.commichael@xam-consulting.com

Q & A

Michael Ridland

michael@xam-consulting.com

www.michaelridland.com

top related