25
www.xam-consulting.com www.michaelridland.com [email protected] Building ‘real-world’ apps with Xamarin.Forms

Building real world apps with Xamarin.Forms

Embed Size (px)

Citation preview

Page 1: Building real world apps with Xamarin.Forms

www.xam-consulting.com [email protected]

Building ‘real-world’ apps

with Xamarin.Forms

Page 2: Building real world apps with Xamarin.Forms

[email protected] 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.

Page 3: Building real world apps with Xamarin.Forms

[email protected] www.xam-consulting.com www.michaelridland.com

Developed Apps WITHOUT Xamarin.Forms

Page 4: Building real world apps with Xamarin.Forms

[email protected] www.xam-consulting.com www.michaelridland.com

Developed Apps WITH Xamarin.Forms

Page 5: Building real world apps with Xamarin.Forms

www.xam-consulting.com [email protected]

My experiences and tips.

Page 6: Building real world apps with Xamarin.Forms

[email protected] 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

Page 7: Building real world apps with Xamarin.Forms

[email protected] 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)

Page 8: Building real world apps with Xamarin.Forms

[email protected] 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.

Page 9: Building real world apps with Xamarin.Forms

[email protected] www.xam-consulting.com www.michaelridland.com

Tip - Don’t fight the Framework

33,000

.NET

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

Page 10: Building real world apps with Xamarin.Forms

[email protected] 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

Page 11: Building real world apps with Xamarin.Forms

[email protected] www.xam-consulting.com www.michaelridland.com

Tip - Style with StackLayout and BoxView

Page 12: Building real world apps with Xamarin.Forms

[email protected] 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.

Page 13: Building real world apps with Xamarin.Forms

[email protected] 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)

Page 14: Building real world apps with Xamarin.Forms

[email protected] www.xam-consulting.com www.michaelridland.com

Tip - Device.StartTimer

Page 15: Building real world apps with Xamarin.Forms

[email protected] 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); }

}

Page 16: Building real world apps with Xamarin.Forms

[email protected] www.xam-consulting.com www.michaelridland.com

Tip - Use a Mvvm

Preferable one with a Convention over Configuration.

Page 17: Building real world apps with Xamarin.Forms

[email protected] www.xam-consulting.com www.michaelridland.com

Tip - Layer Views using AbsoluteLayout

Page 18: Building real world apps with Xamarin.Forms

[email protected] 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

Page 19: Building real world apps with Xamarin.Forms

[email protected] 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

Page 20: Building real world apps with Xamarin.Forms

www.xam-consulting.com [email protected]

Labs Demo

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

Warning 2 - It can be broken and part implemented

Page 21: Building real world apps with Xamarin.Forms

[email protected] 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!

Page 22: Building real world apps with Xamarin.Forms

www.xam-consulting.com [email protected]

Yes! (Probably)

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

Should I use Xamarin.Forms?

Page 23: Building real world apps with Xamarin.Forms

www.xam-consulting.com [email protected]

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

All your pain goes away ….

Page 24: Building real world apps with Xamarin.Forms

www.xam-consulting.com [email protected]

Live Coding - Rolling your own Mvvm

Page 25: Building real world apps with Xamarin.Forms

www.xam-consulting.com [email protected]

Q & A

Michael Ridland

[email protected]

www.michaelridland.com