Download - Sviluppo x platform con xamarin
Sviluppo x-platform con XamarinDan ArdeleanMahiz SrlEmail: [email protected]: @danardelean
Architecting Mobile Apps
Silo Approach
iOS WindowsAndroid
Objective-CXcode
C#Visual Studio
JavaAndroid Studio
No shared code • Many languages & development environments • Multiple teams
Write Once, Run Anywhere
App Generator
LuaJavascript
ActionscriptHTML+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# Mobile
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
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
Code sharing stats
Mac
iOS
Android
Windows
iCircuit
Touch Draw
86%
14%
72%
28%
70%
30%
61%
39%
88%
12%
76%
24%
90%
10%
Building User Interfaces
Traditional UI approach
3 Native User InterfacesShared App Logic
iOS C#
Windows C#Android C#
Shared C# Logic
Xamarin.Forms approach
Shared User InterfaceShared App Logic
Shared C# Logic
Shared UI Code
✓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
Anything you can do in Objective-C, Swift, or Javacan be done in C# with Xamarin.
Development Experience
Xamarin is includedin Visual Studio
Xamarin is included in Visual Studio
Including Community Edition!
Visual Studio for Mac (Preview)iOS, Android, & macOS.NET development.NET Core & ASP.NET CoreTools for Azure
Open Source – open.xamarin.com
Code sharing
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?
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
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)
Shared C# Backend
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
TextToSpeech
Speak(“Hello World”);
AVSpeechSynthesizer SpeechSynthesizer
Plugins for Xamarin
Common API
github.com/xamarin/plugins
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
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
Microsoft’s complete mobile DevOps solution
Develop
Test Build Distribute Monitor
A/B Testing
Live Update Storage
Push Notifications
Crash Reporting Remote Config. Identity
Tables
Visual Studio Mobile Center
mobile.azure.com
Sviluppo x-platform con Xamarin
Mahiz SrlEmail: [email protected]: @danardelean