Xamarin: Introducing a tool for cross-platform development of mobile applications (Part 1)

Fast and efficient development of mobile applications for multiple platforms is neither simple nor cheap. Developers may use a variety of tools for this purpose. At eMan we bet on Xamarin, which came under the wing of Microsoft just a few days ago. In this series, we will gradually introduce this tool to you in detail.

After the introduction of the first iPhone in 2007 and the subsequent formation of the AppStore an entirely new business opened up: the development of mobile applications. The Android platform was soon added to the iOS system, which was followed by the improved Windows Mobile and other more or less successful mobile systems. With the new hardware, both the applications themselves and the method of their development have gradually improved.

Xamarin-code-sharing-eMan-1024x295

Source: Xamarin.com

 

The BASIC programming language Objective-C (iOS) and Java (Android) began to be supplemented with a variety of new solutions. Their main motivation was to help developers accelerate development including the possibility of creating a basic common logic to writing common graphical user interface applications (UI). These “cross-platform solutions” are distinguished by the technology on which they are built, eg. HTML, CSS or JS. Our series will focus on the currently most widely used tool – Xamarin. Before you learn more about Xamarin, take a look with us at examples of other frameworks:

  • PhoneGap – technology based on HTML, CSS, JS
  • Apache Cordova – another technology based on web technologies
  • Fuse – a relatively new framework combining JS and C#
  • RoboVM – framework based on writing iOS and Android applications in Java (note now under Xamarin)

Xamarin allows developers to create applications for the three most widely used platforms (iOS, Android and Windows) and to use the knowledge of the C# environment eg. for writing different kinds of applications in Visual Studio or the use of existing libraries available perhaps on NuGet.

The main components of Xamarin

The heart of Xamarin is built on an open source project called Mono, whose “father” is Miguel de Icaza. It was originally administered by the company Novell, then Xamarin operated as a separate entity. Xamarin was bought by Microsoft on 24 February 2016. Mono is based on the ECMA standards for C# and the Common Language Infrastructure and allows you to write cross-platform applications.

The components of Mono include:

  • C# compiler (note.: currently being transferred to the new .NET compiler Roslyn)
  • Mono-Runtime provides both Just in Time (hereinafter JIT ) and the Ahead of Time (hereinafter AOT) compilation
  • .NET system for Garbage Collector
  • System for processing the behaviour of fibres
  • Base class libraries that are compatible with .NET, expanded by Mono class libraries for special cases

In 2009, the ability to create iOS apps was added to the existing Mono libraries that, unlike traditional libraries, compiled into machine code targeted at iOS applications.

Xamarin.iOS (formerly monotouch) consists of the following elements:

  • Compiler
    • C# mono compiler
    • Third-party compilers like RemObjects Oxygene can also be targeted at Xamarin.iOS
  • developing SDK
    • Linker – a tool for code maintenance and application size reduction
    • mTouch-native compiler and tool for uploading on real devices
    • Integration tools
  • Libraries bound to the native CocoaTouch APIS
  • Core .NET libraries

 

Soon after iOS also added the possibility of developing applications for Android (named monodroid). Here a different kind of compilation than for iOS is used (JIT compilation).

Xamarin. Android is composed of the following units:

  • Mono runtime + Android UI designer
  • Libraries
    • Core .NET libraries
    • Bound to native Android/Java API
  • SDK tools for packaging, debugging and deploying

 

What else

Xamarin-platform-screenshot-eMan-1024x658

Source: Xamarin.com

The Xamarin framework has expanded considerably since its establishment, – since 2011 it has been actively used by over a million developers. Recently (currently the 4th generation version is available) additional tools for development have also been added to it. These include Xamarin Insights (for monitoring) Xamarin Test Cloud (for Unit and UI tests) Xamarin Profiler (for monitoring memory) and others. These tools allow the developer or company to offer a complete solution for creating applications.

In the following articles you will gradually learn about all the important information regarding the Xamarin Framework, from the development of applications in both available IDE: Xamarin and Visual Studio through the technique of writing the common application core and UI to the possibility of monitoring and deploying applications before and after their release. Last but not least, we will also focus on Unit testing.

Vojtech Madr
Xamarin project manager
Vojtěch je mobilní vizionář a odborník na Xamarin. Jeho záměrem je propojit zajímavé lidi a sdílet nové informace a projekty.

RSS