C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Preview:

DESCRIPTION

Presentation from Software Architect 2014, covering Xamarin's offering for building cross-platform mobile applications in C# while using the native platform APIs. The live talk also covered Xamarin.Forms.

Citation preview

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

C# EverywhereCross-Platform Apps with Xamarin

Sasha GoldshteinCTO, Sela Group

blog.sashag.net @goldshtn

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

everyone in this room is a

mobile developer

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

The Search for the Holy Grail

End-user experience

Developer productivity

Native

Web/hybrid

XamarinXamarin

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

The Xamarin Approach

• Fully native apps written entirely in C#

• Visual Studio designer, editor, debugger

• 100% of the native platform API available

• Sharing logic across platforms with PCLs

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

C# on 2.6 Billion Devices

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

How Xamarin Works

• C# bindings to 100% of the native API

• .NET runtime installed on the device as part of the application

• Native compilation– iOS: ahead-of-time compilation– Android: just-in-time compilation (like Java)

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

Tools and Platforms

• Xamarin Studio stand-alone IDE– Cross-platform: OS X and Windows– Supports iOS, Android, OS X

• Visual Studio extension– Windows only– Requires OS X build host for OS X and iOS– Supports Windows Phone and Windows 8

targets

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

Xamarin Successes

Rdio

Bosch-Siemens

Calca

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

DEMOBuilding an Android app in Visual Studio

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

Code Sharing Philosophy

• The view layer usually requires duplication

• The rest of the app (up to 90% code) can be shared

Android UIAndroid UI iOS UIiOS UI Windows Phone UIWindows Phone UI

Shared PCL

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

Platform-Specific Code

• Some platform-specific services are inevitable; hide them behind interfaces

Shared PCLdepends on ILocationProvider

Android layerLocationManager

Android layerLocationManager

iOS layerCLLocationManager

iOS layerCLLocationManager

DI DI

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

DEMOAdding an iOS app with shared components

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

Even More Code Sharing

• Xamarin.Forms is a cross-platform XAML-based UI library for simple controls

• MvvmCross is an open source library that introduces XAML-like data binding and commands to iOS and Android

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

DEMOUsing Xamarin.Forms for 100% code sharing

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

Decision Making

Join the conversation on Twitter: @SoftArchConf #SA2014

This presentation: http://s.sashag.net/sa-xamarin

Thank You!

Sasha Goldshtein

blog.sashag.net

@goldshtn

s.sashag.net/sa-xamarin