native ios and android development with xamarin

Post on 16-Apr-2017

404 Views

Category:

Mobile

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Create native iOS & Android apps with Visual Studio and Xamarin

James Montemagno@JamesMontemagno

Who’s this guy?James

Montemagno

Principal Program Manager – Xamarin, Microsoft

motz@microsoft.com motzcod.es @JamesMontemagno

Weekly development podcast

mergeconflict.fm

Microsoft – Your Complete Mobile Solution

What is native?

Architecting mobile apps

Silo approach

iOS WindowsAndroid

Objective-C

Xcode

C#

Visual Studio

Java

Android Studio

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

Write once, run anywhere

Lua

Javascript

Actionscript

HTML+CSS

Limited native API access • Slow performance • Poor user experience

App

generator

iOS C# UI Windows C# UIAndroid C# UI

Shared C# logic

Xamarin’s unique approach

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

Code sharing stats

Mac

iOS

Android

Windows Phone

iCircuit Touch Draw

86%

14%

72%

28%

70%

30%

61%

39%

88%

12%

76%

24%

90%

10%

Windows APIs

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

C#

iOS – 100% API coverage

MapKit UIKit iBeacon CoreGraphics CoreMotion

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

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

C#

Android – 100% API coverage

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

C#

Native performance

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.

ARM

BINARY

Runs natively

.APPAOT

.NET

C#

Bindings

.APKCompile

and Link

.NET

C#

Bindings

IL

+

JIT

Runs natively

✓ Always up-to-date

Same-day support:

• iOS 5

• iOS 6

• iOS 7

• iOS 8

• iOS 9

• iOS 10

Full support for:

• Apple Watch

• Apple TV

• Android Wear

• Amazon Fire TV

• Google Glass

• and much more

Visual Studio Xamarin Studio

Anything you can do in Objective-C, Swift, or Java can be done in C# and Visual Studio with Xamarin

Xamarin Platform is included for free in Visual Studio

Including Community Edition

Get Xamarin Today

Xamarin.com/Download

Open Source – open.xamarin.com

App building time

Sharing Code

1 Assembly

Multiple Platforms

Including:

Xamarin.iOS and Xamarin.Android

Portable Class Libraries – Profile Based

Share with

ASP.NET Core

.NET Core

and More!

Portable Class Libraries - netstandard

Shared Projects

NuGet

Simplifying Development

Shared C# Logic

What about this stuff?

Platform Specific Code

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

What if we could access it from shared code?

UI+APIs UI + APIsUI + APIs

Battery

GPS

Lights

Notifications

Settings

Text To Speech

Battery

GPS

Lights

Notifications

Settings

Text To Speech

Battery

GPS

Lights

Notifications

Settings

Text To Speech

TextToSpeech

Speak(“Hello World”);

AVSpeechSynthesizer SpeechSynthesizer

A Better API

Plugins for Xamarin

Common API

Xamarin.com/plugins

Plugin Time

Build native UIs for iOS, Android, and Windows

from a single, shared C# codebase.

Meet Xamarin.Forms

Xamarin + Xamarin.Forms

Traditional Xamarin approach With Xamarin.Forms:

More code-sharing, all native

iOS C# UI Windows C# UIAndroid C# UI

Shared C# Logic Shared C# Logic

Xamarin.Forms

What’s included

✓ 40+ Pages, layouts, and controls

(Build from code behind or XAML)

✓ Two-way data binding

✓ Navigation

✓ Animation API

✓ Dependency Service

✓ Messaging Center

Shared C# Logic

Shared UI Code

Pages

Stack Absolute Relative Grid ContentView ScrollView Frame

Content MasterDetail Navigation Tabbed Carousel

Layouts

ActivityIndicator BoxView Button DatePicker Editor

Entry Image Label ListView Map

OpenGLView Picker ProgressBar SearchBar Slider

Stepper TableView TimePicker WebView EntryCell

ImageCell SwitchCell TextCell ViewCell

Controls

Xamarin.Forms ecosystem

Native UI from shared code<?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>

</TabbedPage>

App building time

Integration & Delivery

Test

Build

Distribute & Monitor

Microsoft & Xamarin: Your Complete Mobile Solution

Develop Test Build Distribute Monitor

Thank You!

James

Montemagno

Principal Program Manager – Xamarin, Microsoft

motz@microsoft.com motzcod.es @JamesMontemagno

Weekly development podcast

mergeconflict.fm

Q&A

top related