45
Craig Dunn Developer Evangelist Xamarin [email protected] @conceptdev C# Everywhere we’re not just on Windows any more, Toto...

C# everywhere

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: C# everywhere

Craig DunnDeveloper [email protected]@conceptdev

C# Everywhere

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

Page 2: C# everywhere

C# Everywhere

Mobile!

Page 3: C# everywhere

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

Page 4: C# everywhere

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

Page 5: C# everywhere

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

Page 6: C# everywhere

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

Page 7: C# everywhere

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

Page 8: C# everywhere

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)

Page 9: C# everywhere

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...

Page 10: C# everywhere

How Does it Work?

Page 11: C# everywhere

How Does it Work?

Page 12: C# everywhere

Mac OS X WindowsWindows

IDE

iOS

Android

Mac

Windows/Phone

C# Development Environments

XamarinBusiness Edition+

Mac+

Page 13: C# everywhere

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?!

Page 14: C# everywhere

C# Development Environments

• CodingAuto-completeRefactoring

• User Interface DesignGUI tools

• Debugging• Build & Deploy

Simulators & DevicesTesting & Production/App Stores

Page 15: C# everywhere

IOSC# on iPhone, iPad and iPod touch

Page 16: C# everywhere

iOS Development Environment

Xamarin Studio

Visual Studio

Page 17: C# everywhere

iOS UI Designer

Xcode - now

Xamarin Designer - alpha

Page 18: C# everywhere

iOS Development Environment

• Code signing• App configuration• Deployment

Keychain - certificates

Page 19: C# everywhere

iOS Development Environment

• Code signing• App configuration• Deployment

Provisioning Portalhttp://developer.apple.com

Page 20: C# everywhere

iOS Development Environment

• Code signing• App configuration• Deployment

Page 21: C# everywhere

DEMO

Page 22: C# everywhere

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

Page 23: C# everywhere

Android Development Environment

Xamarin Studio

Visual Studio

Page 24: C# everywhere

Android UI Designer

Xamarin Studio

Visual Studio

Page 25: C# everywhere

Android Development Environment

Shared runtime fordebugging only.

Linking reduces size

Choose CPU arch

Page 26: C# everywhere

Android Development Environment

• AndroidManifest.xmlPermissionsApp configurationuse [Activity] and other attributes

Page 27: C# everywhere

Android Development Environment

• Deployment

Signing wizard

Page 28: C# everywhere

DEMO

Page 29: C# everywhere

MACC# on OS X

Page 30: C# everywhere

OS X Development Environment

Xamarin Studio

Page 31: C# everywhere

OS X UI Designer

Xcode

Page 32: C# everywhere

OS X Development Environment

• Code signing• App configuration

Page 33: C# everywhere

DEMO

Page 34: C# everywhere

CODE SHARINGC# Everywhere!

Page 35: C# everywhere

C# Everywhere

Page 36: C# everywhere

C# Everywhere

Page 37: C# everywhere

To Do List

Page 38: C# everywhere

SHARE

Components

Code

‘Structure’

Design

Page 39: C# everywhere

Field Service

Page 40: C# everywhere

MVVM Example

Shared

Shared

iOS Android

Page 41: C# everywhere

C# Everywhere

Page 42: 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

Page 43: C# everywhere

What else?

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

New features and APIs...• Google Play Services

In app purchasing, Location services, Maps v2

Page 44: C# everywhere

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