What is Xamarin?

Founded in 2011, then acquired by Microsoft in 2016, Xamarin is a platform that allows to develop, test and monitor native applications for iOS, Android and Windows using C# as the development language.

Other platforms exist out there, that allows to create multi-platform applications using a shared code base, but usually those platforms are sitting on top of HTML5, CSS and Javascript creating what we usually call a Web Application.

Native applications usually produce better results with end-users, because they naturally integrate with the platform, are faster, more power efficient and tend to visually look better than their Web App counter-parts.

Xamarin came out as the game changer, because using a single language and development environment, it produces native applications with native user interfaces for the targeted platforms (iOS, Android and Windows). Anything that you can achieve using Swift or Objective-C for iOS and Java for Android, can be achieved as well using Xamarin and C#.

It runs on both Windows and Mac.

In Windows it can be used with Visual Studio, since its integrated with the IDE in the latest versions, or Xamarin Studio.

In Mac a version of Xamarin Studio also exists or we can use Visual Studio for Mac.
A Mac with Xcode is still required when developing, since the iOS compilation has to be done with a Mac computer, specially when in Windows (be it with Visual Studio or Xamarin Studio). Xamarin provides tools that link the Windows computer with the Mac computer over the network and compiles the iOS code remotely.

Two approaches are possible when building apps using Xamarin:

– Traditional Xamarin approach
– Xamarin.Forms approach

screen-shot-2017-01-13-at-07-41-52

As you can see in the figure above, both approaches share all the backend code with all the platforms. Meaning that you only need to write the business logic of the application once, reducing at the maximum the bugs and slight logic diferences introduced when required to code for different platforms.

The main diference of both approaches are in terms of UI building. While the tradicional approach requires to build and program the UI using native elements in each platform, Xamarin.Froms uses a shared code, enhanced with XAML, that then produces native controls in each platform, this means that we build the UI once and it then translates to a UI in the targeted platforms using native elements.

The traditional approach is preferred when building applications that use a very strong custom UI or require to be “pixel perfect”, while the Xamarin.Froms approach is mostly used when the application uses native simple controls or we just want to do a quick prototype. From experience I can tell that wanting to customize UI behaviour and elements when using Xamarin.Forms requires way too much effort and that the final result is never close to what we really wanted to achieve.

While Xamarin might be faster and less error prone in its development cycle it still requires developers who know the targeted native platforms and the diferences and quirks between them.