Building cross-platform mobile apps with Xamarin Hajan Selmani Founder & CEO of HASELT Founder of Hyper Arrow Microsoft MVP App Builders Switzerland @appbuilders_ch
App Builders Switzerland @appbuilders_ch
Session objectives Cross-platform (native) apps development, now and in the future? Understanding Xamarin Why using it? Real reasons and benefits Visual Studio,.NET and C# ios/android/windows Apps with Visual Studio & C# Tooling, plugins, support and current state Showcase
Xamarin Deliver native ios, Android and Windows apps using existing skills, teams, and code.
Xamarin for Everyone
Why Cross-platform with Xamarin and.net? One programming language to rule them all Use C# and Visual Studio to build native apps for any device, any platform now and in the future C# (pronounced as see sharp) is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. High Quality Apps with Shared code-base Support customers on every device, everywhere with shared codebase using one language Avoid platform disparity. Do not fix the same bug three times Full access and control of the platforms Use the best features available on each platform Have full access to all platforms Lower Development Costs
Open Source
.NET Simple, powerful and native
How does it works?
How does it works? C# language Allows you to use a familiar syntax and sophisticated features like Generics, Linq and the Parallel Task Library. Mono.NET framework Provides a cross-platform implementation of the extensive features in Microsoft s.net framework. Compiler Depending on the platform, produces a native app (eg. ios) or an integrated.net application and runtime (eg. Android). The compiler also performs many optimizations for mobile deployment such as linking away un-used code. IDE Tools The Xamarin Studio IDE and the Xamarin plug-in for Visual Studio allow you to create, build and deploy Xamarin projects.
Under the hood Compilation ios C# is ahead-of-time (AOT) compiled to ARM assembly language. The.NET framework is included, with unused classes being stripped out during linking to reduce the application size. Apple does not allow runtime code generation on ios, so some language features are not available (see Xamarin.iOS Limitations ). Android C# is compiled to IL and packaged with MonoVM + JIT ing. Unused classes in the framework are stripped out during linking. The application runs side-by-side with Java/ART (Android runtime) and interacts with the native types via JNI (see Xamarin.Android Limitations ). Windows Phone C# is compiled to IL and executed by the built-in runtime, and does not require Xamarin tools. Designing Windows Phone applications following Xamarin s guidance makes it simpler to re-use the code on ios and Android.
Under the hood Platform SDK Access ios Xamarin.iOS exposes Apple s CocoaTouch SDK frameworks as namespaces that you can reference from C#. For example the UIKit framework that contains all the user interface controls can be included with a simple using MonoTouch.UIKit; statement. Android Xamarin.Android exposes Google s Android SDK as namespaces, so you can reference any part of the supported SDK with a using statement, such as using Android.Views; to access the user interface controls. Windows Phone Windows Phone is not part of the Xamarin platform. When building apps for Windows Phone in C#, the SDK is implicitly available to your application, including Silverlight/XAML controls for the user interface.
Under the hood IDEs Availability
Windows APIs Microsoft.Phone Microsoft.Networking Windows.Storag e Windows.Foundation Microsoft.Device s System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numeric s System.Core System.ServiceMod el
ios 100% API Coverage MapKit UIKit ibeacon CoreGraphics CoreMotion System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numeric s System.Core System.ServiceMod el
Android 100% API Coverage Text-to-speech ActionBar Printing Framework Renderscript NFC System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numeric s System.Core System.ServiceMod el
ios codebase Android codebase Windows codebase Xamarin s Cross-platform approach ios-specific C# Android-specific C# Windows-specific C# Objective-C in XCode Java in Shared Android C# Studio Logic C# in Visual Studio Shared C# codebase 100% native API access High performance
Sharing Code - Strategies Shared Projects Put shared code in a Shared Project Reference the shared project from Android, ios, Windows, Web And the source code from the shared project is included. Very flexible, can use partial classes, very simple, full API access Portable Class Libraries For when you are designing code to be consumed by others Easier to consume by third parties Limited API access
Plugins for Xamarin xamarin.com/plugins Common Mobile API Speech Camera Settings Connectivity SMS Location Platform Native APIs
Xamarin.Forms ios-specific C# Android-specific C# Windows-specific C# Shared Xamarin.Forms UI Objective-C in XCode Java Shared C# Logic in Android Studio C# in Visual Studio
Xamarin Test Cloud
Xamarin Test Cloud
Xamarin Test Cloud
Inspector and Workbooks
Inspector IDE support to inspect live applications Monitor your application live Execute C# code against a running application Make changes, explore your application Powered by Roslyn s C# Cross Platform Supports Android, ios, Mac and Windows
Workbooks Bringing Interactive C# to the next level Learn by experimentation Workbooks are live documents They contain Markdown text With embedded C# code The code executes on demand And re-executes any code after you make changes
THANK YOU Building cross-platform mobile apps with Xamarin Hajan Selmani CEO & Founder of HASELT Microsoft MVP App Builders Switzerland @appbuilders_ch