C# everywhere

Preview:

DESCRIPTION

Presentation for EastBay.NET user group on C# for non-Microsoft platforms like iOS, Android and Mac using Xamarin.

Citation preview

Craig DunnDeveloper EvangelistXamarincraig@xamarin.com@conceptdev

C# Everywhere

we’re not just on Windowsany more, Toto...

C# Everywhere

Mobile!

How Does it Work?

• Mono C# + .NET implementation for Linuxstarted in 2001/released 2004perfect fit for today’s mobile platforms: iOS & Android.NET 4.5 / C# 5

• “Bindings”exposes underlying SDKs as C#

think “projections” in Windows RT language:http://stackoverflow.com/questions/7432905/what-are-winrt-language-projectionshttp://tirania.org/blog/archive/2011/Sep-15.html

How Does it Work?

• “Bindings”exposes CocoaTouch/Objective-C as C#you can write your own to incorporate any Objective-C

• Compilercompiles IL and native runtime into native ARM appcan link out unused code - smaller executablessigns code for device testing and upload to App Store

iOS

How Does it Work?

• “Bindings”exposes Android/Java as C#you can write your own to incorporate any Java

• Compilerproduces IL and ships a native runtime to execute itcan link out unused code - smaller executablessigned for distribution to any phone, or stores like Google Play, Amazon, ...

Android

How Does it Work?

• “Bindings”exposes Cocoa/Objective-C as C#you can write your own to incorporate any Objective-C libraries/projects

• Compilerproduces IL and ships a native runtime to execute itcan link out unused code - smaller executablesapps can be distributed via Mac App Store

OS X

Why Xamarin.iOS?

• Write C# apps for iPhone, iPad and iPod• Share C# with other platforms:

re-use C# from existing projects• Create native iOS user interface• Native app == native performance• Entire iOS SDK directly accessible

(StoreKit, iCloud, etc)• You can add your own Objective-C libraries too

Why Xamarin.Android?

• Write C# apps for Android phones & tablets• Share C# with other platforms:

re-use C# from existing projects• Create native Android user interface• Native runtime == native performance• Entire Android SDK available (including

Play Services and Compat Library)• Use Java libraries (if required)

Why Xamarin.Mac?

• Write C# apps for Mac OS X• Share C# with other platforms:

re-use C# from existing projects• Create native Mac (Cocoa) user interface• Native app == native performance• Entire Mac SDK directly accessible • You can add your own Objective-C libraries too

companion apps...

How Does it Work?

How Does it Work?

Mac OS X WindowsWindows

IDE

iOS

Android

Mac

Windows/Phone

C# Development Environments

XamarinBusiness Edition+

Mac+

Mac OS XWindows

Visual Studio Xamarin Build Host

Xamarin.iOS for Visual Studio plug-in

Build Host configurationiOS Projects

iOS Property PagesiOS build, deploy, debug

iOS Output panes

Device iOS Simulator

Apple iOS SDKXcode

Interface BuilderCompiler

Keychain CertificationsProvisioning Profiles

Networkaccess

iOS appsin Visual Studio?!

C# Development Environments

• CodingAuto-completeRefactoring

• User Interface DesignGUI tools

• Debugging• Build & Deploy

Simulators & DevicesTesting & Production/App Stores

IOSC# on iPhone, iPad and iPod touch

iOS Development Environment

Xamarin Studio

Visual Studio

iOS UI Designer

Xcode - now

Xamarin Designer - alpha

iOS Development Environment

• Code signing• App configuration• Deployment

Keychain - certificates

iOS Development Environment

• Code signing• App configuration• Deployment

Provisioning Portalhttp://developer.apple.com

iOS Development Environment

• Code signing• App configuration• Deployment

DEMO

ANDROIDC# on Android (Google Play, Kindle, ...)

Android Development Environment

Xamarin Studio

Visual Studio

Android UI Designer

Xamarin Studio

Visual Studio

Android Development Environment

Shared runtime fordebugging only.

Linking reduces size

Choose CPU arch

Android Development Environment

• AndroidManifest.xmlPermissionsApp configurationuse [Activity] and other attributes

Android Development Environment

• Deployment

Signing wizard

DEMO

MACC# on OS X

OS X Development Environment

Xamarin Studio

OS X UI Designer

Xcode

OS X Development Environment

• Code signing• App configuration

DEMO

CODE SHARINGC# Everywhere!

C# Everywhere

C# Everywhere

To Do List

SHARE

Components

Code

‘Structure’

Design

Field Service

MVVM Example

Shared

Shared

iOS Android

C# Everywhere

Recap

• Build iOS apps in C# with .NET• Use Xamarin Studio or Visual Studio• Apps have native look and feel• Apps are native, with native performance• Share code• Component Store

http://components.xamarin.com

What else?

• async/await• F#• Portable Class Libraries (PCL)• iOS7

New features and APIs...• Google Play Services

In app purchasing, Location services, Maps v2

Go!• 10 minute guide to building an app

http://xamarin.com/getting-started • Docs, Recipes

http://docs.xamarin.com/• Forums

http://forums.xamarin.com• Samples

http://github.com/xamarin

http://xamarin.com/download

Questions?Developer EvangelistXamarincraig@xamarin.com@conceptdev

Craig Dunn

Recommended