Crossing Platforms with Xamarin

Today, I’m gonna share about my experience in building cross platform apps using Xamarin. Over a year and half ago, I embarked on a clueless journey to explore and develop some app for a company using Xamarin technology. Our strategy is simple, we build iOS and Android app using whatever experience we had on cross platform be it, Titanium or Phonegap on a Mac OS Platform. In Xamarin, you can develop Apps in 4 common ways :-xamarin-logo

  1. Xamarin.iOS – is used to develop iOS only app, using C#. You design your UI using their built-in Interface Builder, or via coding method. Compiles to a signed IPA at the end of the day.
  2. Xamarin.Android – is used to develop Android counterpart only app, using C#. You design your UI using their built-in Android Designer, or via coding method as well. Like Xamarin.iOS, it basically compiles into APK like Android Studio at the end of the day.
  3. Cross Platform – involves by creating two sets of platform codes under one project. Basically, by selecting this option, the IDE will basically create two separate platform codes in 2 folders. Xamarin.iOS and Xamarin.Droid. You still work on the codes and UI design like 1 and 2 separately. However, you can share generic platform independent classes (ones that doesn’t platform specific dependencies). You can share business logic and some utility classes etc and import it into both platform folders.
  4. Cross Platform (Xamarin Form) – like (3) however, the UI is written in a new universal format, known as Xamarin Forms – where it is powered by XAML. With this method, you can make seamless design in cross platform and saves you a lot of time in preparing the UI.

screenshot1

I’ve prepared a list of pros and cons of Xamarin below for references.

The Pros

  1. Everything is powered by C# and a very powerful IDE (Xamarin studio for free) to back that up. Heck, you can even use Visual Studio to develop.
  2. If you are familiar with .Net libraries (commonly used ones e.g. RestSharp, Newtonsoft.JSON etc, you can make use of most of them here. Hey, we can even use cool LINQ feature from .Net. Imagine using Linq to queries through your json results or SQLLite records.
  3. Xamarin has their own interface builder and Android designer build in to manage UI and they looked pretty close to Xcode and Android Studio.
  4. You can share business logic in generic classes using C# as shared project codes, and share it over to Android and IOS. For example, MemberRegistration.cs class manages all member registration and sign up logic, can be written in platform independent class (a normal C# code) and it can be then imported into Xamarin.Android or Xamarin.iOS to reuse.
  5. Xamarin.iOS and Xamarin.Android syntaxes and code style is almost mimicking the native code style. You can even refer to an real Native Android Java sample code found somewhere in StackOverflow, and then try to code the same implementation using C# way and it will work.

The Cons

  1. Well nothing is perfect, sometimes updates of framework or even their code APIs, will break your project and you will need support. At times, you might not even able to compile without manually fixing some project references or files.
  2. Some good libraries and component are not free, they have Xamarin components – this is like a marketplace to download component packages to ease your development however, most of them are not free – some of them are quite pricey.
  3. You will still need a mac or at least a mac in network (for iOS development if you are thinking of developing in Windows), this is not really a cons but, more like Apple strict policy.
  4. Very expensive enterprise licensing – however, good news is; ever since Microsoft bought over Xamarin – all MSDN enterprise licensing company will enjoy a free enterprise licensing from Xamarin as well.

Common FAQ

If you asked me is it worth paying so much for an enterprise licensing for Xamarin for an indie company of 2-5 developers? My answer is no – unless you want to make full use of Xamarin own cloud based testing and insights system and support. Getting individual or indie license for each platform is good enough (up to date pricing was USD 25 per platform). Single developer per platform licensing is allowed in 4 machines assuming you have some in network or in Virtual machines.

 

Comments

comments