What is native? - info.microsoft.com Roadshow... · What is native? Native User ... MapKit UIKit...

43

Transcript of What is native? - info.microsoft.com Roadshow... · What is native? Native User ... MapKit UIKit...

What is native?

Native User Interfaces Native API Access Native Performance

Architecting mobile apps

Silo approach

iOS WindowsAndroid

Objective-C/Swift

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

MyDriving – A Native App

Using Traditional Xamarin Approachhttps://aka.ms/my-driving

Xamarin Platform is

included in Visual Studio

Including Community Edition

Open Source – open.xamarin.com

CocosSharp

UrhoSharp

How Xamarin Works

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 for Mac (Preview)iOS, Android, & macOS

.NET development

.NET Core & ASP.NET Core

Tools for Azure

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

Code Sharing

Xamarin.iOS Xamarin.Android

Portable Class Libraries

.NET Standard Libraries

.NET STANDARD LIBRARYOne library to rule them all

NuGet

Shared Projects

Code sharingstats

Mac

iOS

Android

Windows

iCircuit Touch Draw

86%

14%

72%

28%

70%

30%

61%39%

88%

12%

76%

24%

90%

10%

Simplifying Development

Shared C# Backend

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

Common API

Cross-platform UI

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 & 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>

Connecting the dots…

Let me translate that for you!

Get started todayxamarin.com/download

Free self-guided courses