state of union: xamarin & cross-platform .net in 2016 and beyond

80
Nick Landry Senior Technical Evangelist – Microsoft [email protected] Blog: AgeofMobility.com @ActiveNick | github.com/ActiveNick State of Union: Xamarin & Cross-Platform .NET in 2016 and Beyond

Upload: nick-landry

Post on 16-Apr-2017

473 views

Category:

Technology


0 download

TRANSCRIPT

Nick LandrySenior Technical Evangelist – Microsoft

[email protected]

Blog: AgeofMobility.com

@ActiveNick | github.com/ActiveNick

State of Union:

Xamarin & Cross-Platform .NET

in 2016 and Beyond

Agenda

Silo Approach

iOS WindowsAndroid

Objective-C

Xcode

C#

Visual Studio

Java

Android Studio

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

Write Once, Run Anywhere

App Generator

Lua

Javascript

Actionscript

HTML+CSS

Limited native API access • Slow performance • Poor user experience

Xamarin’s Unique Approach

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

iOS C# UI Windows C# UIAndroid C# UI

Shared C# Logic

C# and Xamarin’s unique approachThe best of all worlds

2016: A Great Year for Xamarin Developers!

Xamarin is included

in Visual Studio

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

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

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

All 3 characteristics are required for a truly native app

Xamarin is native in all 3 ways

Native User Interface

Apps are built with standard, native

user interface controls for easy and

familiar interactions

Apps have access to the full spectrum of

functionality exposed by the underlying

platform and device

Apps leverage platform-specific hardware

acceleration, and are compiled as native

binaries, not interpreted at runtime.

High-fidelity API Access

Native Performance

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.

Same-day support:• iOS 5• iOS 6• iOS 7• iOS 8• iOS 9

✓Always Up-to-DateFull support for:• Apple Watch• Apple TV• Android Wear• Amazon Fire TV• and much more

Visual Studio

Xamarin.com/Download

Visual Studio Integration

New Light & Dark Themes in Xamarin Studio

Xamarin Studio - Sharable Components

Demo:

Tour of the Xamarin

Developer Experience

Xamarin exposes 100% of the native APIs

for iOS, Android and Windows

Anything you can do in Objective-C, Swift, or Java

can be done in C# with Xamarin using Visual Studio

Cross-Platform .NET:How did we get here?How can we make it better?

Browser Phone

Meet Xamarin.Forms

Xamarin + Xamarin.FormsWith Xamarin.Forms:

more code-sharing, native controls“Classic” Xamarin approach

Shared UI 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>

Native UI from shared code

Xamarin.Forms: Build Native User InterfacesUsing Shared Code

Shared App Logic in C#

Xamarin.Forms comes with over 40

common controls, pages and layouts to

make app UI creation fast and easy

Even basic animations are supported

Xamarin.Forms is Fully Extensible:

• Subclass included controls and

customize behavior

• Define and add your own controls,

layouts, pages and cells

• Expose your own platform-specific

controls in Xamarin.Forms pages

Xamarin.Forms is open source too!

• Multi-Touch Enabled

• Pressure Sensitive

• Super Fast

• Rotate, screenshots,location changes

• Never leave Visual Studio

NEW! Visual Studio iOS Simulator Remoting

Xamarin.Forms XAML Previewer

Demo:

Sharing UI Code with

Xamarin.Forms

Use Decide Screen-by-Screen

Xamarin.Forms is great for forms-based

screens. You can mix Xamarin.Forms with

the full power of Xamarin.iOS and

Xamarin.Android in the same app for

complete control over your app’s look and

feel.

Xamarin.Forms: Mix-and-Match Screen-by-Screen, Element-by-Element

Call Platform APIs via Shared Services

Need platform-specifc functionality within a

Xamarin.Forms page, such as querying the

accelerometer? We’ve included services that

quickly and easily abstract platform-specific

API calls to keep you writing as much shared

code as possible.

Embed Custom Views Anywhere

Not only are Xamarin.Forms pages

mixable with custom screens, you can

embed custom views built directly

against Xamarin.iOS and

Xamarin.Android into Xamarin.Forms

pages.

Roadmap

XAML Compilation

Parsed and inflated

Parsed & turned into IL

XAML Compilation Usage

[XamlCompilation(XamlCompilationOptions.Compile)]

[XamlCompilation(XamlCompilationOptions.Skip)]

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]

XAML Compilation Benefits

Xamarin.Forms Ecosystem

https://evolve.xamarin.com/session/56e205b0bad314273ca4d817

https://medium.com/@harrycheung/mobile-app-performance-redux-e512be94f976#.glqa5cmx6

Xamarin.Forms Performance

Sharing Code

Shared Projects

1 Assembly

Multiple Platforms

Including:

Xamarin.iOS and Xamarin.Android

Portable Class Libraries

NuGet

Choosing a Code Sharing Option

Demo:

Sharing Code with PCLs

Sharing Code Beyond

PCLs and .NET Standard:Lighting-up Platform-Specific Code

Complementing .NET

PlatformSpecific 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

Xamarin Components and Plugins

https://github.com/xamarin/XamarinComponents

https://components.xamarin.com

TextToSpeech

Speak(“Hello World”);

AVSpeechSynthesizer SpeechSynthesizer

Plugins for Xamarin

Common API

Sharing Code Beyond PCLs & .NET Standard

Sharing Code Beyond PCLs & .NET Standard

Demo:

Plugins for Xamarin &

Windows

More New Stuff

Skia Sharp - 2D Graphics Library

Xamarin Workbooks – Interactive C#

Xamarin Profiler

Xamarin Profiler – Cycle Detection

Fall Themes

Watch dotNetConf 2016for more on Xamarin, .NET, .Net Core, ASP.NET, Open Source, the Future, etc.

http://www.dotnetconf.net/

Summary

github.com/ActiveNick/MyWeather

github.com/ActiveNick/MyWeatherNUI

github.com/jamesmontemagno/MyWeather.Forms

github.com/xamarin/xamarin-forms-samples

github.com/xamarin/mini-hacks

github.com/xamarin

https://github.com/jamesmontemagno

http://motzcod.es

Session Demos & Xamarin Videos

https://aka.ms/xamebook

https://aka.ms/xamebook/epub

https://aka.ms/xamebook/mobi

Free Xamarin.Forms eBook

https://blog.xamarin.com/performing-ocr-for-ios-android-and-windows-with-microsoft-cognitive-services/

https://github.com/pierceboggan/smarter-apps/tree/master/ExpenseIt/

https://blog.xamarin.com/adding-facial-recognition-to-your-mobile-apps/

https://github.com/pierceboggan/smarter-apps/tree/master/talk/employee-directory/

https://github.com/xamarin/mini-hacks/tree/master/microsoft-cognitive-services/solutions

Demo: Xamarin + Cognitive Services

https://github.com/DotNetToscana/See4Me

https://github.com/ActiveNick/BingTranslateDemo

Demo: Xamarin + Cognitive Services

http://xamarin.com/download

http://docs.xamarin.com

http://evolve.Xamarin.com

http://xamarin.com/university

http://blog.xamarin.com

http://motzcod.es

http://weblogs.asp.net/wallym

http://www.gregshackles.com

Xamarin Resources

Online Microsoft training delivered by experts to help technologists continually learn

Hundreds of courses for developers, IT Pros, students, entrepreneurs and enthusiasts

11 different languages

More than 2.1M students registered

Build your own Learning Plan

All free!

Cross-Platform Development withXamarin & Visual Studio

aka.ms/MVAxamarin

http://www.microsoftvirtualacademy.com

Thank You!

Slides are posted SlideShare. Demos are on GitHub.

Slideshare: www.slideshare.net/ActiveNick

Blog: www.AgeofMobility.com

Twitter: @ActiveNick

Mobile Apps: www.bigbaldapps.com

LinkedIn: www.linkedin.com/in/activenick

GitHub: github.com/ActiveNick

Email: [email protected]