Introduction to Xamarin

21
Enterprise Mobile Apps Xamarin and C# We Love This Stuff

description

Presentation we delivered for the the GRMobileDev meetup (http://www.meetup.com/Grand-Rapids-Mobile-Development-Group/events/141015692/) on 10/2/2013. We introduced the Grand Rapids, MI mobile dev community to Xamarin and leveraging C# cross platform.

Transcript of Introduction to Xamarin

Page 1: Introduction to Xamarin

Enterprise Mobile AppsXamarin and C#

We Love This Stuff

Page 2: Introduction to Xamarin

About Us (http://www.ostusa.com/app-dev)

• Brian Anderson• Founder of OST’s app dev practice / Business Dev• Crowe -> SageStone -> NuSoft -> OST

• Nick Westbrook• Sr. Consultant (worked on ArtPrize 1.0)• … -> Spout -> Family Christian -> OST

• Mike Perry• Sr. Consultant • NuSoft -> Amway -> KPMG -> OST

• Alex Jantz• Consultant• Belcan (Aerospace dev and EE) -> OST

Page 3: Introduction to Xamarin

Xamarin History (via Wikipedia)• In June 2000, Microsoft first announced their .NET Framework.[4] Miguel de Icaza of Ximian began

investigating whether a Linux version was feasible.[5] The Mono open source project was launched on July 19, 2001. Ximian was bought by Novell on August 4, 2003.

• After the acquisition of Novell by Attachmate in April 2011, Attachmate announced hundreds of layoffs for the Novell workforce, including Mono developers,[6]putting the future of Mono in question.[7][8]

• On May 16, 2011, Miguel De Icaza announced on his blog that Mono would be developed and supported by Xamarin, which planned to release a new suite of mobile products. According to De Icaza, at least part of the original Mono team had moved to the new company.[9]

• After this announcement, the future of the project was questioned, since MonoTouch and Mono for Android would now be in direct competition with the existing commercial offerings owned by Attachmate, and considering that the Xamarin team would have difficulty proving that they had not used technologies previously developed when they were employed by Novell for the same work.[10][11]

• In July 2011, however, Novell, now a subsidiary of Attachmate, and Xamarin announced that Novell had granted a perpetual license for Mono, MonoTouch and Mono for Android to Xamarin, which formally and legally took official stewardship of the project.[12][13]

• In December 2012, Xamarin released Xamarin.Mac,[14] a plugin for the existing MonoDevelop Integrated development environment (IDE), allowing developers to build C#-based applications for the Apple OS X operating system and package them for publishing via the Apple App Store.

• In February 2013, Xamarin announced the release of Xamarin 2.0.[15] The release included two main components: Xamarin Studio, which bundled Xamarin's previous, separate iOS, Android and Apple OS X development tools into a single application;[16] and integration with Visual Studio, Microsoft's IDE for the .NET Framework, allowing Visual Studio to be used for creating applications for iOS and Android, as well as for Windows.

Page 4: Introduction to Xamarin

Xamarin Framework History

•Mono• C# + .NET implementation for Linux• started in 2001/released 2004 (C# 1.0)

•MonoTouch (for iOS) – 2009 (iPhone OS 3.0, pre-ipad)

•Mono for Android – 2011 (Android 2.3 Gingerbread)

•MonoDevelop IDE•MonoMac open source project

Page 5: Introduction to Xamarin

Why Xamarin?• Apps are native, performance is native• Entire platform SDK available to your code:• iOS: StoreKit, EventKit, iCloud, etc• Android: Play Services, Compatibility Library, etc

• Share C# across Xamarin, Windows & WinPhone apps• Leverage platform-specific libraries:• iOS: Objective-C• Android: Java

Page 6: Introduction to Xamarin

Why does this matter?

1. User experience2. Performance3. Features

We don’t believe that HTML5 apps give a truly native experience•Proof = Facebook Apps

Page 7: Introduction to Xamarin

How does it work?

Page 8: Introduction to Xamarin

How does it work?

Page 9: Introduction to Xamarin

Xamarin Development Environments

Page 10: Introduction to Xamarin

iOS apps in Visual Studio

Page 11: Introduction to Xamarin

DemoXamarin Studio (Mac & Windows), Visual Studio, Debugging, Storyboards

Page 12: Introduction to Xamarin

Enterprise Mobile Apps

Page 13: Introduction to Xamarin

Real Enterprise Project Experience• Project description• Starting with iPhone• Building on top of large infrastructure with existing RESTful API and a

common domain library• Leveraging an enterprise Onion Architecture

• Domain driven design• Domain services• App services• UI per platform• Defined infrastructure layers for communication and data abstraction

• Dependency Injection• ORM with Linq support• Repository patterns

• We wanted to leverage components (ie Charts & more) to save time and $

Page 14: Introduction to Xamarin

DemoHow are we architecting it? Where are we at in the dev cycle?

Page 15: Introduction to Xamarin

Pro / Cons

Pros

• C# - makes for fast coding of back-end patterns• Lots of shared code cross-

platform• Clean IDE, easy to pick up

and run with

Cons• New platform

• Still gaining support for things like AutoMapper, Ninject, and PCL’s

• SVN add-in needs work (or remove it completely. We really need this project to migrate to Git anyway.)• Poor Storyboard stability when

used with SVN• File linking in the presentation

layers can be a pain

Page 16: Introduction to Xamarin

Tips• If using SVN: Use Xcode to install the Command Line

Tools (if not already installed) and use Terminal to run SVN commands.• You can create XIB (nib) files for complex views and

avoid using the Storyboard• Expect a learning curve if you haven’t worked with iOS

view controllers before

Page 17: Introduction to Xamarin

Something Fun

Page 18: Introduction to Xamarin

Skunk works• Azure Mobile Services• Android / iOS with shared core• Including communication with on premise Web API

• Custom microcontroller designed using ElectricImp.com• A stop light

Let the final demo begin…

Page 19: Introduction to Xamarin

How it works

Page 20: Introduction to Xamarin

Circuit

Page 21: Introduction to Xamarin

Questions / Thoughts