Yesterdays dotNed meeting was hosted at Macaw and was about App Development with Xamarin. There were two sessions that evening:
- Session 1: QuickCross - MVVM for Xamarin Apps by Vincent Hoogendoorn
- Session 2: Best Practices voor Xamarin Android App Development by Sander Egberink
Below are my notes.
Short intro to Xamarin
With Xamarin you can create native iOS, Andriod, Mac and Windows apps in C#. The benefit of it is that you can share code between the platforms so that you can create -for example- a iOS and a Android app based on the same code base. So write once and use on 2.5 billion devices (as the Xamarin marketeers would say). With C# you can use the latest .NET 4.5 features, e.g. sync/await and PCL’s. Coming soon: Universal Application support for VS2013 Update 2. The developer community is very active (about 500k+ developers worldwide), so new native mobile features are also quickly available for iOS and Android.
For the IDE’s you have two choices. It’s possible to develop in Visual Studio with a special Xamarin extension. Alternatively you can develop in Xamarin Studio. For each platform it’s advisable / required to have physical appliances. Per platform:
- Andriod: VS on Windows + Android device
- iOS: Can use VS on windows for coding & debugging. Requires a MAC + Xamarin Studio for build, deploy and Xcode for UI Visual
- Windows Phone: Just reuse the shared C# code – no Xamarin libraries or tools are involved.
The licensing model for Xamarin is per developer and platform: $999 on a yearly basis. So Visual Studio (Express will not work) + Xamarin + required hardware will add up to a pretty high pricetag to start with. But for organizations this will be a small investment and the ROI will be easy to calculate. Xamarin itself is available as a full functional 30 day trial version.
QuickCross is a framework developed by Macaw that works with Xamarin. It is a lightweight (no binaries) cross-platform MVVM (Model View ViewModel) pattern to quickly build native Xamarin.iOS, Xamarin.Android, Windows Phone and Windows Store Apps with shared C# code. The MVVM patterns enable the developer to keep code well structured and flexible for shareable use. QuickCross opens the C# databinding feature towards iOS and Android applications and adds scaffolding. QuickCross is available on GitHub and as a NuGet package.
QuickCross accelerates development with scaffolding by using code snippets. From the Visual Studio package manager console you can use QuickCross commands to generate code: New-ViewModel and New-View. To generate bindable properties, the have include some smart VS code snippets which is a real time server. About 90% of the code can be shared between platforms. Shared components are C# code, PCLs (portable class libraries), NuGet package, Images (using the Splat! library). Seperate per platform are: Views C#, Markup. Platform specific services written in C#. Visual overview of what is cross-platform and what’s platform specific:
All the QuickCross code is open source and actually used as source in your project. So it’s not a blackbox and you can debug, extend or modify it. Even the scaffolding templates are easily customizable. The team behind QuickCross did a good job about documenting the framework. Getting started, examples, migrating from MvvmCross: it’s all there.
Best practices session
Sander showed us some cases of the Apps that they developed with Xamarin. About online/offline capabilities. How to deal with offline Maps on Android. How to think about multi lingual apps (create bindable properties). How to make you design fluent for longer translated text. Nice to have some insights about the challenges that they encounter. Since it was a long day for me, I didn’t take any notes . At least I took a picture that sums it up :-)
Compare xplatform frameworks and patterns: http://propertycross.com/
QuickCross on GitHub: https://github.com/MacawNL/QuickCross#news
Vincent Hoogendoorn blog: http://vincenth.net/blog/
Using iBeacons with Xamarin: http://vincenth.net/blog/archive/2014/04/24/building-cross-platform-ibeacon-apps-for-ios-android-and-windows-with-c-and-xamarin.aspx