7 Things You Need To Know About Xamarin and Xamarin Forms

When most think about app development for iOS, their minds instantly go to using Objective-C versus using Swift – seeing as they’re native tech platforms for Apple products. Likewise, for Android, Java is the first point of call for most people.

But what if you want your app to communicate across multiple platforms? It seems like wasted effort when there are more efficient ways to build user-friendly apps that share 90% of the code across the two platforms. Namely Xamarin, and Xamarin.Forms.

What Is Xamarin:

As we just touched upon, Xamarin is a tool used for cross platform mobile app development. Engineers can share up to 90% of the code across the platforms, saving on time and effort, and pushing that release schedule forward by a fair margin.

It’s fairly new on the market having been released in 2016, when Microsoft acquired the creator company and set about releasing it as open source. If it looks familiar that’s because it’s based off the .Net Framework.

Xamarin uses the C# programming language to create apps for all mobile platforms, and is natively compiled to give it that native look and feel while delivering high performance. Being C#, strong safety typing prevents the code from doing weird stuff.

How Xamarin works is to use this singular C# language, paired with native libraries, all wrapped within the .Net cocoon. In this way, iOS and Android user experience is equal to that of Objective-C, Swift and Java thanks to the access to the API and all other native libraries and functions.

All the code relevant to business logic, database access and communication across the network is then shared across all the platforms in an umbrella user interface code layer. When it comes time to building the actual user interface, the native code is drawn upon so that it looks and acts native – but isn’t.

What Is Xamarin.Forms:

So, the name is a little confusing. The pieces forming up the separate chucks of the user interface on screen are often called views, dialogs and pages. Xamarin.Forms is a separate extension that does just that – keeping the user interface bits and pieces in logical sub-areas of the application.

Building an app with a single screen? You’re going to have a bad time, just think about how you’re going to cram all that data and user interaction into a single screen. You can’t, really. Or more to the point, you can’t do it well.

Xamarin.Forms does this by using pages. Yes, it would have made more sense to call it Xamarin.Pages, but we didn’t get the naming rights so what’s done is done. It goes further than Xamarin.Native by expressing the native platform user interface components as representations of code by using an easily readable markup language.

If Xamarin.Native deals with the shared back-end code, then Xamarin.Forms effectively operates in the same way as iOS View Controller, Android Activity, and the Windows Phone Page in the sense that it replaces the native elements with yet more sharable code across the platforms.

Pros:

Single Technology Stack:

The big one here is the 90% sharable code. Combining C# with the powerful .Net framework drastically speeds up the development and engineering cycle as there is no code switching between the environments of each platform.

Just as Good:

Another big plus is that an app built around Xamarin performs nearly as good as one developed using a native framework for that particular platform. Though a hybridized system, Xamarin can be considered native in the sense that it draws upon the native functions and libraries. Think way easier development, for a fractionally reduced performance trade off.

User Experience:

As it draws from the native libraries, an app featuring Xamarin will feel like an iOS app on iOS and an Android app on Android. The user won’t be able to tell the difference, and there will be no janky or clunky user interface often associated with non-native frameworks.

Well Supported:

The hardware powering a particular platform will perform exactly as it would with a native app, as Xamarin doesn’t have any hardware compatibility issues, require the use of any

plugins or weird application programming interfaces, and maintains regular device functionality.

All Inclusive:

Being open source, Xamarin includes the runtime environment, libraries and all command line tools as part of the package and standard license making it a powerful tech stack.

Easy to Fix:

Maintenance is a breeze, as any updates, maintenance, or patches are simply deployed in the source file and will be translated across to all the supported platforms regardless of the device operating system – saving both time and money.

Environmental:

Xamarin also comes with its own independent development environment as standard. Visual Studio has now incorporated many separate features like testing, distribution and analytics tools. A free toolkit means you won’t have to invest in any additional extras, or look to third party apps to build, test and deploy your Xamarin based app.

Cons:

A Bit Slack:

It must be said that although the Xamarin development team work hard to add more and more to the framework, it does take some time for compatibility support to be made available for other 3rd party tools that are platform specific – namely the latest iOS and Android releases, as well as new libraries and features.

Limited Access:

While you do have access to Xamarin libraries, and native libraries by way of the .Net extension framework, the choice is not as good as going down the dedicated native iOS or Android app development route.

Can Be Pricey:

Though it’s open source and great for independent developers, if you’re an enterprise the upgraded Visual Studio license will cost a pretty penny, so something to consider.

Small Community:

The Xamarin user community number a significantly smaller group compared to native iOS and Android developers. As such, finding an experienced Xamarin developer can be a little tricky. Only 5.8% of apps use Xamarin frameworks, compared to Flutter (7.2%) and React Native (11.5%).

Basic Knowledge Needed:

To make a truly seamless and native looking app across multiple platforms, naturally there has to be a certain level of knowledge and expertise when writing a layer of code to make sure the API of each platform is talking to the Xamarin back-end code effectively. So, Java, Objective-C and Swift are skillsets you’ll need to be at least moderately proficient with.

Chonky:

Xamarin based apps are generally larger file size wise than their native equivalents, somewhere in the realm of about double. Additional optimization is required to remove any unused code from the libraries – linking will keep the file size down somewhat.

Its Days May Be Numbered:

Microsoft has announced that Xamarin, and in particular Xamarin.Forms, is going to merge with .Net to form a new cross platform framework called Multi-Platform App UI or MAUI. The process of integration will be gradual over the next few iterations of .Net but it will definitely be happening. Let’s hope for a smooth transition.

How Does It Compare:

So Xamarin isn’t the only cross-platform framework in town. Both Flutter and React Native are more popular amongst developers, and also boast similar functionality. So how do they measure up to Xamarin?

Xamarin vs Flutter:

So, if we compare Xamarin to Flutter, then Flutter does have the faster code implementation and edge that developers need to fix bugs in a timelier manner. This is possible thanks to the ability to instantly view any changes made in the code on hardware, emulators and simulators.

It also edges ahead in terms of customization. It’s possible that, in addition to all the built-in libraries and functions, you can create your own or even modify existing ones.

Flutter does suffer from the same app size issue as Xamarin however, and being quite a new framework, does tend to struggle with native application programming interfaces.

Developers are often forced to compress images, opt to not use certain animations, or event limit the packages and libraries used.

Xamarin vs React Native:

The strength of React Native is in its user interface. It’s simplified and very high quality, meaning it’s often referred to as an open-source JavaScript instead of a framework. It’s also developed and backed by tech giants Facebook, and their team frequently and reliably upgrades React Native.

It has a gigantic library of user interface components, speeding up the development phase substantially. These include access to native functions such as device cameras, accelerometer, etc.

Changes can be made to the apps instantly without the need to recompile them which is a big advantage. The Fast Refresh option allows syntax errors to be fixed and saved in the source code.

It does fall over a bit when it comes to animations and more complex transitions into the native libraries and elements. The navigation within Native React based apps also leaves a lot to be desired, and although 3rd party plugins are supported, they don’t have the same level of security as a natively developed app.

Who’s Using Xamarin:

As it turns out, there are quite a few well-known apps that use Xamarin. Companies like UPS, Alaska Airlines, and APX Travel Management use them for their booking and tracking systems. Likewise, there are many games on the App Store and Google Play Store that are Xamarin based. The World Bank, CA Mobile, and Captio are all apps that use Xamarin for automated business expense management with great success.

As with everything, Xamarin, Flutter and React Native all have their little pros and cons. Flutter has the gold medal in fast app development and is the logical choice for those under time constraints. React Native is extremely popular, and arguably the easiest cross platform framework. Then again, Xamarin combined with Xamarin.Forms shares a whopping 96% of existing code across all platforms – insanely high compared to other frameworks.

Career Compensation:

Wonder no more – the average salary for a Xamarin programmer in the USA is $105,000 per year. That’s not bad, considering a systems or software engineer earns a salary of $110,000.

The average salary also varies pretty wildly according to where you are in America. Xamarin programmers in Colorado are paid the most, earning $131,625 per year on average, followed by New York ($130,000), Georgia ($123,375), and California ($118,500).

Next Steps:

We hope this blog helped you learn more about the strengths and weaknesses of Golang and Python! If you can’t choose between them then you can always learn both!

If you enjoyed this blog you may also enjoy our other blogs like, Erlang and 5 Things You Need to Know About It or Clojure and 5 Things You Need to Know About It.

Kofi Group is proud to be a source of knowledge and insight into the startup software engineering world and offers a multitude of resources to help you learn more, improve your career, and help startups hire the best talent. If you are interested in learning more about what we do and how we can help you then get in touch or watch our Youtube videos for additional information.