Cross-platform app development with Xamarin

There are now many different approaches to the development of mobile apps. For years, we have focused on cross-platform development, which is now the standard in the industry alongside native apps and PWAs. We mainly use Xamarin and Xamarin.Forms. We explain why this is the case below:

What is cross-platform development?

For every company embarking on a mobile app project, sooner or later the question arises as to which operating systems you want to make the app available for. Should the app only be made available to iPhone users? Or perhaps only Android users? Both? What about Windows Phone? And does Blackberry actually still exist?

A look at the distribution of market shares quickly makes it clear that the two tech giants Google and Apple are dividing the market between them. Combined, they have a 98.2% market share in Switzerland with their mobile operating systems Android and iOS. A look at the figures for the last three years shows that this quasi-duopoly is becoming even more entrenched than there is any competition to be seen:

The answer to the question posed at the beginning about which operating system is best for your app is therefore almost always: iOS and Android.

Now there are different approaches to developing an app for 2 platforms, all of which have their advantages and disadvantages. The most common are the following:

Native app

A native app is an application that has only been developed for a specific platform. This means that the iOS app is programmed completely independently of the Android app. This means that two separate teams of developers are used, both working more or less independently of each other in the respective programming languages (Swift and Objective-C for iOS, Java for Android). Although this achieves the highest possible performance, the development of the app is relatively time-consuming and resource-intensive due to the double track.

Cross Platform

The need to publish an app as efficiently as possible for multiple operating systems is of course not entirely new. So it’s no wonder that frameworks (i.e. development environments) have been around for several years that are designed for precisely this purpose. So instead of having to develop an app twice in two different programming languages, you have a common code base thanks to the cross-platform framework. Depending on the framework and project, between 70% and well over 90% of the entire code can then be used for both platforms.

It is therefore possible to write the software independently of the operating system and in the end only make relatively minor platform-specific adjustments for implementation on iOS or Android.

This leads to enormous time savings, both in the initial development and in the maintenance or implementation of updates or new features.

What is Xamarin?

Xamarin was founded back in 2011 with the aim of distributing mobile software. Since 2016, the company has been part of Microsoft, with whose support it has become one of the most widely used cross-platform frameworks in the world.

Xamarin is available in two versions, Xamarin.Platform and Xamarin.Forms. Forms is an extension of the framework that is consistently designed for cross-platform development. Xamarin.Forms could be described as an abstraction between the platforms, with which buttons or other UI layers can be controlled via API. This means that UI code can also be shared between platforms and only needs to be written once. This increases the proportion of shared code to over 95%, which is obviously much more efficient.

Xamarin.Platform vs. Xamarin.Forms. Source: microsoft

Increased efficiency or not. Working with Xamarin is also more convenient for developers, as a project can be written from A to Z with C# and several different programming languages do not have to be used.

Advantages of Xamarin

Development with cross-platform frameworks in general and with Xamarin.Forms in particular has a number of advantages. An overview:

Shared code base

  • up to 95% of the code can be used for both platforms
  • significantly lower costs for development and maintenance and
  • Simplified update process

Native performance & user experience

  • Hardly any differences in performance compared to native apps
  • User experience corresponds to the platform
  • Full support of hardware and device functions

High flexibility

  • Cross-platform implementation with the option of responding to platform-specific cases as required

Established platform

  • Xamarin has existed since 2011, Xamarin.Forms since 2014
  • Large developer community
  • Good selection of plugins and components
  • Large learning database

Faster troubleshooting

  • Xamarin Analytics automatically records user behavior by platform and device, making it relatively easy to track down bugs

Disadvantages of Xamarin

Where there is light, there is of course also shadow, which is why we don’t want to close our minds to the disadvantages of Xamarin. Working with the popular cross-platform framework also has its disadvantages:

  • Plugins are not always up-to-date
  • Some platform-specific special cases are not available for Xamarin.Forms
  • Operating system updates (iOS / Android) are available with a time delay
  • The Xamarin community is smaller than the native iOS or Android community
  • App size: Xamarin apps are on average around twice as “heavy” as native apps
  • Relatively high license costs for Xamarin Visual Studio

Case Study: Xamarin.Platform vs. Xamarin.Forms

That sounds all well and good in theory, but what does it look like in reality? To show why we rely on Xamarin.Forms, let’s compare two of our projects with each other.

In the left-hand corner: mobilmed – a health app that we developed in 2011
In the right-hand corner: FOOBY – the comprehensive cooking app from Coop

Admittedly, the mobilmed app has been around for a few years and is no longer in use. Nevertheless, the comparison is interesting, as we also developed mobilmed with Xamarin.

The comparison shows impressively that Xamarin.Platforms already saves a lot of effort, but that using Xamarin.Forms brings another significant improvement. 88% of the code of the entire FOOBY app is identical for both platforms, which of course means a huge minimization of effort.