16
Join the conversation on Twitter: @SoftArchConf #SA2014 This presentation: http://s.sashag.net/sa-xamarin C# Everywhere Cross-Platform Apps with Xamarin Sasha Goldshtein CTO, Sela Group blog.sashag.net @goldshtn

C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Embed Size (px)

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

Page 1: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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

Page 2: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Join the conversation on Twitter: @SoftArchConf #SA2014

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

everyone in this room is a

mobile developer

Page 3: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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

Page 4: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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

Page 5: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Join the conversation on Twitter: @SoftArchConf #SA2014

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

C# on 2.6 Billion Devices

Page 6: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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)

Page 7: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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

Page 8: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Join the conversation on Twitter: @SoftArchConf #SA2014

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

Xamarin Successes

Rdio

Bosch-Siemens

Calca

Page 9: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Join the conversation on Twitter: @SoftArchConf #SA2014

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

DEMOBuilding an Android app in Visual Studio

Page 10: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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

Page 11: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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

Page 12: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Join the conversation on Twitter: @SoftArchConf #SA2014

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

DEMOAdding an iOS app with shared components

Page 13: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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

Page 14: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Join the conversation on Twitter: @SoftArchConf #SA2014

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

DEMOUsing Xamarin.Forms for 100% code sharing

Page 15: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

Join the conversation on Twitter: @SoftArchConf #SA2014

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

Decision Making

Page 16: C# Everywhere: Cross-Platform Mobile Apps with Xamarin

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