Xamarin v.Now

3,651 views

Published on

Presentation to Xamarin User Group in San Francisco, 19-Sep-2013... all the latest in Xamarin technology including iOS, Android, Xamarin Studio, Portable Class Libraries, Async/Await and TestCloud.

Published in: Technology
  • Be the first to comment

Xamarin v.Now

  1. 1. Craig Dunn Developer Evangelist Xamarin craig@xamarin.com @conceptdev v.Now The future is now :)
  2. 2. Agenda • About Xamarin • Xamarin 2.0 • v.Now C# 5 - async await iOS UI Designer iOS 7 Google Play Services for Android Test Cloud
  3. 3. About 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 user experience performance features
  4. 4. About Xamarin • Mono C# + .NET implementation for Linux started in 2001/released 2004 • MonoTouch (for iOS) - 2009 • Mono for Android - 2011 • MonoDevelop IDE • MonoMac open source project iPhoneOS 3.0, pre-iPad Android 2.3 Gingerbread C# 1.0
  5. 5. About Xamarin • Mono C# + .NET implementation for Linux started in 2001/released 2004 • MonoTouch (for iOS) - 2009 • Mono for Android - 2011 • MonoDevelop IDE • MonoMac open source project Mono 3.2 .NET 4.5 C# 5 iOS 7 Android 4.3 Jelly Bean
  6. 6. Xamarin 2.0 • Xamarin Studio • Xamarin.iOS Visual Studio • Xamarin.Android • Component Store • Free Starter Edition http://xamarin.com/guide/ http://blog.xamarin.com/announcing-xamarin-2.0/
  7. 7. How Does it Work? Windows C# Xaml C# Network,  Storage,   Business  Logic UI wire -­‐up logic run/me pla2orm .NET UI your  code
  8. 8. How Does it Work? Mono  .NET  RunBme Windows  PhoneAndroid iOS WindowsMac Shared  Code  (C#) .NET XamlAndroid  Xml Storyboards XIB Xamarin.Android Xamarin.iOS Xamarin.Mac C# C# C# C# Xaml C# H7pClient  &  WebServices                      SQLite.NET  &  database                    IO                    more... UI wire -­‐up logic run/me pla2orm UIUIUIUIUI your  code
  9. 9. Mac OS X WindowsWindows IDE iOS Android Mac Windows/Phone Xamarin Development Environments Xamarin Business Edition+ Mac +
  10. 10. Mac OS XWindows Visual Studio Xamarin Build Host Xamarin.iOS for Visual Studio plug-in Build Host configuration iOS Projects iOS Property Pages iOS build, deploy, debug iOS Output panes Device iOS Simulator Apple iOS SDK Xcode Interface Builder Compiler Keychain Certifications Provisioning Profiles Network access iOS apps in Visual Studio?!
  11. 11. Xamarin Development Environments • Coding Auto-complete Refactoring • User Interface Design GUI tools • Debugging • Build & Deploy Simulators & Devices Testing & Production/App Stores
  12. 12. IOS C# on iPhone, iPad and iPod touch
  13. 13. iOS Development Environment Xamarin Studio Visual Studio
  14. 14. iOS UI Designer Xcode - now Xamarin Designer - beta
  15. 15. iOS Development Environment • Code signing • App configuration • Deployment Keychain - certificates
  16. 16. iOS Development Environment • Code signing • App configuration • Deployment Provisioning Portal http://developer.apple.com
  17. 17. iOS Development Environment • Code signing • App configuration • Deployment
  18. 18. DEMO iOS
  19. 19. ANDROID C# on Android (Google Play, Kindle, ...)
  20. 20. Android Development Environment Xamarin Studio Visual Studio
  21. 21. Android UI Designer Xamarin Studio Visual Studio
  22. 22. Android Development Environment Shared runtime for debugging only. Linking reduces size Choose CPU arch
  23. 23. Android Development Environment • AndroidManifest.xml Permissions App configuration use [Activity] and other attributes
  24. 24. Android Development Environment • Deployment Signing wizard
  25. 25. DEMO Android
  26. 26. CROSS PLATFORM Portable code...
  27. 27. What is a Portable Class Library? Subset of .NET that is supported across the set of target platforms. Starting with File > New App gives you platform- specific code, eg. Windows Store
  28. 28. What is a Portable Class Library? Subset of .NET that is supported across the set of target platforms. Some Microso! platforms (eg. Windows Phone) are more restricted than Xamarin.
  29. 29. What is a Portable Class Library? Subset of .NET that is supported across the set of target platforms. Some Microso! platforms (eg. Windows Phone) are more restricted than Xamarin. but no dynamic (AOT)
  30. 30. What is a Portable Class Library? Profile1 NetForWSA, Net4, SL4, WP7, XBox360
  31. 31. What is a Portable Class Library? Profile2 NetForWSA, Net4, SL4, WP7
  32. 32. What is a Portable Class Library? Profile104 NetForWSA, Net45, SL4, WP75
  33. 33. PCL Example Tasky Portable XML An abstract implementation of a data storage class, with implementation for each platform Profile 158
  34. 34. PCL Example The Portable Class Library is compiled in a way that is sharable. We create a Provider for each platform
  35. 35. DEMO Tasky Portable
  36. 36. ASYNC AWAIT C# 5 tailor-made for mobile!
  37. 37. Mobile Apps • Need responsive user interfaces • App features are o!en dependent on: network access database functionality or I/O complex processing on mobile CPUs stuff that takes some time • You want to run these on a different thread to keep the UI responsive... they should be ASYNCHRONOUS! Fast! Long running tasks! Threads! All
  38. 38. DEMO Async Await
  39. 39. Old-style callbacks 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length 6) InvokeOnMainThread Callback Hell
  40. 40. Callback Hell Old-style callbacks 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length 6) InvokeOnMainThread
  41. 41. Old-style callbacks • Spaghetti code: Callbacks are the new “GOTO” Control flow jumps around in ways that are difficult to read & understand from the source Error handling is difficult to implement, required in many different places Changes in the chain can have unintended consequences http://tirania.org/blog/archive/2013/Aug-15.html
  42. 42. 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length Comparison Async-ified 6) InvokeOnMainThread
  43. 43. 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length Comparison 6) InvokeOnMainThread one place not required Async-ified
  44. 44. Comparison 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length 6) InvokeOnMainThread old new!
  45. 45. DEMO Tasky Parse
  46. 46. TEST CLOUD Scalable, repeatable real device testing
  47. 47. Test Cloud
  48. 48. Test Cloud
  49. 49. Test Cloud
  50. 50. Test Cloud
  51. 51. RECAP
  52. 52. Recap • Build iOS & Android apps in C# with .NET Latest language features • Use Xamarin Studio or Visual Studio • Apps are native, with native performance • Share C# code • Latest C# 5 features • Component Store http://components.xamarin.com • Test Cloud http://testcloud.xamarin.com
  53. 53. Questions? Developer Evangelist Xamarin craig@xamarin.com @conceptdev Craig Dunn • Documentation http://docs.xamarin.com/ • Samples http://github.com/xamarin http://xamarin.com/download

×