deep dive in xamarin.forms

43

Upload: james-montemagno

Post on 27-Jul-2015

171 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: Deep Dive in Xamarin.Forms
Page 2: Deep Dive in Xamarin.Forms

JamesMontemagnoDeveloper Evangelist, Xamarin

[email protected] http://motzcod.es @JamesMontemagno

Page 3: Deep Dive in Xamarin.Forms

DESIGN – DEVELOP -‐ INTEGRATE TEST MONITOR

LEARN

Page 4: Deep Dive in Xamarin.Forms
Page 5: Deep Dive in Xamarin.Forms

Native User Interfaces Native API Access Native Performance

? ? ?

Page 6: Deep Dive in Xamarin.Forms
Page 7: Deep Dive in Xamarin.Forms

-John Gruber

http://daringfireball.net/2015/05/facebook_instant_articles

Page 8: Deep Dive in Xamarin.Forms
Page 9: Deep Dive in Xamarin.Forms

iOS WindowsAndroid

Objective-CXcode

C#Visual Studio

JavaAndroid Studio

No shared code • Many languages & development environments • Multiple teams

Page 10: Deep Dive in Xamarin.Forms

App Generator

LuaJavascript

ActionscriptHTML+CSS

Limited native API access • Slow performance • Poor user experience

Page 11: Deep Dive in Xamarin.Forms

Shared C# codebase • 100% native API access • High performance

iOS C# UI Windows C# UIAndroid C# UI

Shared C# Mobile

Page 12: Deep Dive in Xamarin.Forms

Shared F# codebase • 100% native API access • High performance

iOS F# UI Windows F# UIAndroid F# UI

Shared F# Mobile

Page 13: Deep Dive in Xamarin.Forms

Microsoft.Phone Microsoft.Networking Windows.Storage Windows.Foundation Microsoft.Devices

System.Data System.Windows System.Numerics System.Core System.ServiceModel

System.Net System System.IO System.Linq System.Xml

Page 14: Deep Dive in Xamarin.Forms

MapKit UIKit iBeacon CoreGraphics CoreMotion

System.Data System.Windows System.Numerics System.Core System.ServiceModel

System.Net System System.IO System.Linq System.Xml

Page 15: Deep Dive in Xamarin.Forms

Text-to-speech ActionBar Printing Framework Renderscript NFC

System.Data System.Windows System.Numerics System.Core System.ServiceModel

System.Net System System.IO System.Linq System.Xml

Page 16: Deep Dive in Xamarin.Forms

Xamarin.iOS does full Ahead Of Time (AOT) compilation to produce an ARM binary for Apple’s App Store.

Xamarin.Android takes advantage of Just In Time (JIT) compilation on the Android device.

.NET

C# Compileand Link .APK

Bindings

RunsNatively

IL+

JIT

Page 17: Deep Dive in Xamarin.Forms
Page 18: Deep Dive in Xamarin.Forms

✓Always Up-to-Date•••••

•••••

Page 19: Deep Dive in Xamarin.Forms
Page 20: Deep Dive in Xamarin.Forms

Mac

iOS

Android

Windows Phone

Calca iCircuit Touch Draw

86%

14%

72%

28%

77%

23%

70%30%

61%39%

94%

6%

88%

12%

76%

24%

90%

10%

Page 21: Deep Dive in Xamarin.Forms
Page 22: Deep Dive in Xamarin.Forms

Traditional Xamarin Approach

With Xamarin.Forms:More code-sharing, all native

iOS C# UI Windows C# UIAndroid C# UI

Shared C# Backend

Xamarin.Forms

Shared C# Backend

Page 23: Deep Dive in Xamarin.Forms

✓ 40+ Pages, layouts, and controls(Build from code behind or XAML)

✓ Two-way data binding✓ Navigation✓ Animation API✓ Dependency Service✓ Messaging Center

Shared C# Backend

Shared UI Code

Page 24: Deep Dive in Xamarin.Forms

Which Xamarin approach is best for your app?

Xamarin.Forms is best for: Xamarin.iOS / Xamarin.Android is best for:

• 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

Learn more: xamarin.com/forms Learn more: xamarin.com/platform

• Apps that require specialized interaction

• Apps with highly polished design

• Apps that use many platform-specific APIs

• Apps where custom UI is more important than code sharing

Page 25: Deep Dive in Xamarin.Forms

<?xml version="1.0"  encoding="UTF-­‐8"?><TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"

xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"x:Class="MyApp.MainPage">

<TabbedPage.Children><ContentPage Title="Profile"  Icon="Profile.png">

<StackLayout Spacing="20" Padding="20"VerticalOptions="Center">

<Entry Placeholder="Username"Text="{Binding  Username}"/>

<Entry Placeholder="Password"Text="{Binding  Password}"IsPassword="true"/>

<Button Text="Login"  TextColor="White"BackgroundColor="#77D065"Command="{Binding  LoginCommand}"/>

</StackLayout></ContentPage><ContentPage Title="Settings"  Icon="Settings.png">

<!-­‐-­‐ Settings -­‐-­‐></ContentPage></TabbedPage.Children>

Page 26: Deep Dive in Xamarin.Forms

Layouts

Pages

Stack Absolute Relative Grid ContentView ScrollView Frame

Content MasterDetail Navigation Tabbed Carousel

Page 27: Deep Dive in Xamarin.Forms

ActivityIndicator BoxView Button DatePicker Editor

Entry Image Label ListView Map

OpenGLView Picker ProgressBar SearchBar Slider

Stepper TableView TimePicker WebView EntryCell

ImageCell SwitchCell TextCell ViewCell

Page 28: Deep Dive in Xamarin.Forms

Xamarin.Forms Ecosystem

Page 29: Deep Dive in Xamarin.Forms
Page 30: Deep Dive in Xamarin.Forms

Windows Xamarin.FormsStackPanel StackLayout

TextBox Entry

ListBox ListView

CheckBox Switch

ProgressBar ActivityIndicator

Grid Grid

Label Label

Button Button

Image Image

Date/TimePicker Date/TimePicker

Page 31: Deep Dive in Xamarin.Forms

Windows Xamarin.Forms

DataContext BindingContext

{Binding Property} {Binding Property}

ItemsSource ItemsSource

ItemTemplate ItemTemplate

DataTemplate DataTemplate

Page 32: Deep Dive in Xamarin.Forms
Page 33: Deep Dive in Xamarin.Forms
Page 34: Deep Dive in Xamarin.Forms
Page 35: Deep Dive in Xamarin.Forms

Shared C# Backend

Page 36: Deep Dive in Xamarin.Forms

What if we didn’t have to write this code?

What if we could access it from shared code?

UI+APIs UI + APIsUI + APIs

BatteryGPSLightsNotificationsSettingsText To Speech

BatteryGPSLightsNotificationsSettingsText To Speech

BatteryGPSLightsNotificationsSettingsText To Speech

Page 37: Deep Dive in Xamarin.Forms

TextToSpeech

Speak(“Hello World”);

AVSpeechSynthesizer SpeechSynthesizer

Page 38: Deep Dive in Xamarin.Forms

Common API

Page 39: Deep Dive in Xamarin.Forms
Page 40: Deep Dive in Xamarin.Forms

Get Started Todayxamarin.com

Page 41: Deep Dive in Xamarin.Forms

xamarin.com/university

Unrivaled Mobile Development

Training

Live unlimited mobile development training from mobile experts, in your time-zone, on your schedule, and as often as you'd like.

Page 42: Deep Dive in Xamarin.Forms

https://github.com/jamesmontemagno/TripExpenses.Forms

http://tryappservice.azure.comhttps://components.xamarin.com/view/azure-mobile-services

http://github.com/xamarin/plugins

http://developer.xamarin.com

Page 43: Deep Dive in Xamarin.Forms

Thank you.

JamesMontemagnoDeveloper Evangelist, Xamarin

[email protected] http://motzcod.es @JamesMontemagno

Questions?