sviluppo x platform con xamarin

30
Sviluppo x- platform con Xamarin Dan Ardelean Mahiz Srl Email: [email protected] Twitter: @danardelean

Upload: dan-ardelean

Post on 19-Mar-2017

64 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Sviluppo x platform con xamarin

Sviluppo x-platform con XamarinDan ArdeleanMahiz SrlEmail: [email protected]: @danardelean

Page 2: Sviluppo x platform con xamarin

Architecting Mobile Apps

Page 3: Sviluppo x platform con xamarin

Silo Approach

iOS WindowsAndroid

Objective-CXcode

C#Visual Studio

JavaAndroid Studio

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

Page 4: Sviluppo x platform con xamarin

Write Once, Run Anywhere

App Generator

LuaJavascript

ActionscriptHTML+CSS

Limited native API access • Slow performance • Poor user experience

Page 5: Sviluppo x platform con xamarin

Xamarin’s Unique Approach

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

iOS C# UI

Windows C# UIAndroid C# UI

Shared C# Mobile

Page 6: Sviluppo x platform con xamarin

C#/.NET Build Across Platforms

.NET + C# +

BindingsAoT .APP

Native ARM

Binary

.NET + C# +

BindingsCompile & Link ..APK IL + JIT =

NativeAndroid

iOS

Windows .NET + C# + Bindings

Native Compile .APPX

Native ARM/x86/x6

4 Binary

Page 7: Sviluppo x platform con xamarin

Platform Access with Xamarin

System.Data System.Windows

System.Numerics System.Core System.ServiceMod

el

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

Microsoft.Phone Microsoft.Networking

Windows.Storage

Windows.Foundation

Microsoft.Devices

MapKit UIKit iBeacon CoreGraphics CoreMotion

Text-to-speech ActionBar Printing Framework Renderscript NFC

Windows

iOS

Android

Page 8: Sviluppo x platform con xamarin

Code sharing stats

Mac

iOS

Android

Windows

iCircuit

Touch Draw

86%

14%

72%

28%

70%

30%

61%

39%

88%

12%

76%

24%

90%

10%

Page 9: Sviluppo x platform con xamarin

Building User Interfaces

Page 10: Sviluppo x platform con xamarin

Traditional UI approach

3 Native User InterfacesShared App Logic

iOS C#

Windows C#Android C#

Shared C# Logic

Lacey Butler
I see Justgiving, Outback, our internal app, but what's the photo-centric app? Storyo?
James Montemagno
Yup, that is storyo from the case studies
Page 11: Sviluppo x platform con xamarin

Xamarin.Forms approach

Shared User InterfaceShared App Logic

Shared C# Logic

Shared UI Code

Page 12: Sviluppo x platform con xamarin

✓Always Up-to-Date Full support for:

• Apple Watch• Android Wear• Amazon Fire TV• Google Glass• and much more

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

Page 13: Sviluppo x platform con xamarin

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

Page 14: Sviluppo x platform con xamarin

Development Experience

Page 15: Sviluppo x platform con xamarin

Xamarin is includedin Visual Studio

Xamarin is included in Visual Studio

Including Community Edition!

Page 16: Sviluppo x platform con xamarin

Visual Studio for Mac (Preview)iOS, Android, & macOS.NET development.NET Core & ASP.NET CoreTools for Azure

Page 17: Sviluppo x platform con xamarin

Open Source – open.xamarin.com

Page 18: Sviluppo x platform con xamarin

Code sharing

Page 19: Sviluppo x platform con xamarin

Anytime you are writing code which does not depend on a specific platform feature, it is potentially sharable, particularly if it: Talks to a web service Parses a data format Works with a database Performs processing / business logic

Where can I use shared code?

Page 20: Sviluppo x platform con xamarin

Use HttpClient for REST services,can then process with System.Xml / System.Json LINQ to XML Newtonsoft JSON.net

component Use WCF or .asmx for SOAP

Web Services

Page 21: Sviluppo x platform con xamarin

SQLite included in iOS + Android forlocal data storage can be added to WinPhone

Can also store in the cloud – Azure Mobile Services, Amazon, Dropbox, etc.

Data Access (Database)

Page 22: Sviluppo x platform con xamarin

Shared C# Backend

Page 23: Sviluppo x platform con xamarin

PlatformSpecific CodeWhat 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 24: Sviluppo x platform con xamarin

TextToSpeech

Speak(“Hello World”);

AVSpeechSynthesizer SpeechSynthesizer

Page 25: Sviluppo x platform con xamarin

Plugins for Xamarin

Common API

github.com/xamarin/plugins

Page 26: Sviluppo x platform con xamarin

NuGet is a package manager for.NET that allows you to locate, install, update and remove shared components from your projects right in your IDE

NuGet

www.nuget.org

Page 27: Sviluppo x platform con xamarin

Several well-known patterns can be used to break dependencies and loosely-couple components together referred to as “Inversion of

Control” (IoC) allow reusable components to

call into platform-specific code (vs. the other way around)

Locating Services – Inversion of Control

FactoryServicePatternLocator

Dependency Injection

Page 28: Sviluppo x platform con xamarin

Microsoft’s complete mobile DevOps solution

Develop

Test Build Distribute Monitor

Page 29: Sviluppo x platform con xamarin

A/B Testing

Live Update Storage

Push Notifications

Crash Reporting Remote Config. Identity

Tables

Visual Studio Mobile Center

mobile.azure.com

Page 30: Sviluppo x platform con xamarin

Sviluppo x-platform con Xamarin

Mahiz SrlEmail: [email protected]: @danardelean