Category
Mobile

Xamarin.Forms vs Xamarin Native: What’s The Difference?

What are the differences between Xamarin.Forms and Xamarin.iOS/Android? Learn about the capabilities of each to choose right for your business app.

Despite the apparent desire of Apple, Samsung, Google, and Microsoft to enclose all users in their respective mono-brand walled gardens, we live in the era of multiplatform consumer tech. The joy of choice and the active competition pushing progress forward are among the many benefits of this era.

One of the downsides, though, is the need for application producers to build and maintain many identical products for various platforms. It’s often paramount to support at least two or three different ‘ecosystems’ from the get-go or risk shutting out large portions of potential audiences.

When platform coverage is crucial but it’s not possible to maintain several native applications, deploying multi-platform development frameworks is the next best thing.

There are many frameworks to pick from: React Native, Ionic, Cordova, Flutter, and many more, all with their own strengths and weaknesses. One of the most popular choices is Xamarin, in large thanks to its UI design tooling—Xamarin.Forms.

A Xamarin Refresher

Xamarin is an open-source multiplatform development framework that allows building applications with a shared codebase using C# and .NET.

Based on the Mono framework, Xamarin was initially developed for building mobile and macOS apps. After it was acquired by Microsoft in 2016 and incorporated into the .NET family, its reach expanded. Right now, you can use Xamarin to create apps for iOS, Android, Windows (UWP), macOS, and Samsung’s Tizen. Variations of iOS and Android are also supported: Apple TV, iOS Watch, iPadOS, Android TV, Android Watch, etc.

There are various pros and cons of Xamarin development for business. For many, the point of particular interest is the UI shareability in Xamarin.

UI Code Sharing in Xamarin

Creating a consistent, snappy and native-feeling UI is the usual sticking point for many cross-platform frameworks. In the “classic” Xamarin development, the approach is to create a single shared access to the business logic and database, and then build distinct UIs for Android and iOS in C#. This is achieved separately with Xamarin.iOS and Xamarin.Android, so no UI is actually shared.

1_Building cross-platform apps in Xamarin Native

The benefits and shortcomings of this approach are quite clear. On the one hand, you still get the benefit of a single technology stack to use for both platforms in order to produce a native UI with an absolute fidelity down to every platform-specific element and function, no corners cut.

On the other hand, the need for building every element twice (or more) can put an obvious damper on how your project progresses, especially in a business setting.

This is where Xamarin.Forms comes in.

The big difference between #Xamarin.iOS / #Xamarin.Android and #Xamarin.Forms is the approach to building UI
Tweet

What Xamarin.Forms Brings to the Table

Microsoft defines Xamarin.Forms as another open-source UI framework on top of Xamarin. It allows developers to quickly build prototypes and interfaces with XAML (eXtensible Application Markup Language), which is Microsoft's variant of XML for GUI, on top of the shared C# codebase for multiplatform applications. 

Creating multiplatform apps that share not only their backend code but also a significant portion of the GUI can dramatically decrease the amount of work and speed up the development process. When you hear that Xamarin apps for different platforms can share up to 95% of the code, this usually means Xamarin.Forms is at play.

2_XAMARIN + XAMARIN.FORMS

Upon its first release in 2014 and for some years after, Xamarin.Forms was considered secondary to Xamarin Native, and mostly not production-ready. For a long time, the major complaints about Forms focused on its limited capabilities and the slow speed of apps built with it. Using much more advanced and capable Xamarin.Android and Xamarin.iOS provided better performance and look, while Forms were often seen as suitable only for very basic apps.

Things have been slowly changing lately, though.

Forms is becoming more advanced and capable. Judging by how Microsoft Xamarin’s team has been pushing through new features in the last two years, their new priority is to make Xamarin.Forms the best version of itself and a truly universal tool that fully follows the “write once, use everywhere” motto.

Get a team of experts for your mobile development project

The Current State of Xamarin Native and Forms

So far, 2019 has brought major updates to Xamarin and Forms in particular. This year, Microsoft has introduced:

  • Additional styling, navigation, search, and hierarchy options for Xamarin.Forms with Shell.
  • Xamarin.Forms fast renderers, which improve performance through creating fewer objects, thus simplifying view tree and freeing up memory.
  • Startup tracing, which effectively addresses the common lag when starting up Xamarin apps.
  • Further integration capabilities for Xamarin.Forms and Xamarin Native, including significant updates to Native Forms, which allows the usage of Xamarin.Forms elements in Xamarin Native applications.
  • Substantial improvements to Xamarin.Forms Messages and overall app performance.
  • Numerous updates to Forms UI tools, including collection view, new content view classes, new and updated elements (search bar, switches/toggles, buttons, etc.), CarouselView, refreshView and pull-to-refresh functionality, third-party controls support, theming, and more.
3_Light and dark themed pages in a Xamarin.Forms app for iOS and Android

In addition, many open-source Xamarin projects expand on the framework’s capabilities. For example, the Uno Platform that allows creating Xamarin apps for the web.

#Xamarin.Forms has a bit of a bad rap, considered by many to be sluggish and limited. 2019, however, has been a year of great leaps and changes for Forms. Take a look:
Tweet

XAML Hot Reload and Xamarin Hot Restart

For years, the lack of Hot Reload functionality has been considered one of the most significant drawbacks of Xamarin.

Hot Reload updates UI content display in real or near real time whenever changes are made to the code. Hot Reload missing in Xamarin was especially lamented by developers when compared to React Native (and later Flutter), which both had it very early on. Finally, in August 2019, this long-awaited feature was announced and is now available for XAML.

This is actually a big deal, since Hot Reload massively speeds up development: now, instead of needing to fully rebuild and deploy applications before checking the changes, developers can instantly see what any code change does to the app.

4_XAML_Hot_Reload
4_Source

Similarly, the Hot Restart feature (that also works for C# code changes, not just XAML), speeds up rebuilding and deployment when those are needed.

Initially rolled out as a working preview for iOS and Android, by November 2019 XAML Hot Reload and Hot Restart have both been expanded to other platforms and fully integrated into the stable Xamarin release.

When to Use Xamarin.Forms and When to Go for Xamarin Native?

The choice to use the Xamarin development framework can be made through comparing it to alternatives and carefully considering in-depth reviews. Or maybe you already have an experienced in-house C#/.NET development team who swear by their technology stack.

But when is it better to use Xamarin Native, and when to stick to Forms instead? It depends on the type of app and UI you’re going for.

Xamarin.Forms will be enough for clean apps with native look and feel, with more or less standard grid/list views and animations and not too many platform-specific features. The need for minor fine-tuning can always be expected, but for most standard business apps, Forms would be a decent choice.

These are some of the features and elements easily achieved with Xamarin.Forms in order to create smooth and near-native cross-platform interfaces:

  • Information display and search

  • Messaging

  • Items showcase, multidirectional scrolling

  • Image display

  • Data sectioning

  • Login and signup forms

  • Media playback, and so on.

6_XAML—UI design for a weather app with Xamarin.Forms
6_Source

Tight time and/or budgetary restrictions can also be another cue to choose Xamarin.Forms as a speedier and more easily maintained multiplatform development option.

Going for Xamarin Native will provide more flexibility and options for custom feature development. Forms is still far from the best when it comes to unique UI design or complex hardware- and platform-specific requirements.

If your primary reason for using Xamarin is less about high-level code sharing and budgeting but more about keeping the development within the C#/.NET ecosystem, Xamarin Native will likely be a better choice. The same goes for apps that are supposed to have many custom and platform-specific features.

7_Xamarin Native vs Xamarin.Forms
#Xamarin.Forms vs #XamarinNative: when to choose which?
Tweet

Windows Phone Is Dead, What Does It Mean for Xamarin?

Many worry that Xamarin’s days are numbered once Microsoft completely shuts down Windows Mobile OS (the update patches will stop on December 10, 2019, and the backup support officially ends in March 2020). Is it true though?

The answer is a resounding no. Having a proprietary platform behind a multiplatform development tool is definitely beneficial (think Google’s support of Kotlin, and the still vague outline of Fuchsia on the horizon), but not mandatory. Microsoft’s Xamarin development team made it clear back in 2017 that the deprecation of Windows Mobile support would have no effect on Xamarin’s future as a framework.

As the information on Windows Mobile was swiftly removed from the official documentation and as evident in many subsequent Xamarin updates, the long-foreseen demise of WP doesn’t hinder Xamarin’s moving forward. The “being a part of something bigger” aspect of Xamarin, however, does manifest in its close relation to the .NET framework.

What’s in Store for Xamarin and Forms?

Allegedly, Google holds big plans for Flutter; React Native has expansive new features and coverage planned, and native development is as strong as ever.

Xamarin’s next frontier is not in incremental updates either. In the grand scheme of things, the framework definitely seems to be in an interesting place.

.NET 5: One Framework to Rule Them All

6_.NET— A unified platform

The .NET team’s goal is to create a platform to build anything and everything. Web, mobile, desktop, IoT, machine learning for any device and system—.NET is set to cover it all.

In the .NET family of products, Xamarin is the first and foremost tool for mobile application development.

As James Montemagno, a long-standing Xamarin development leader and evangelist, says,

If you’re interested in mobile development and have .NET background, you’re basically already 80% there. All the architecture, libraries and so on—all of that will be available and familiar to you [in Xamarin].
James Montemagno

Therefore, the roadmap of Xamarin and Forms is inextricably linked to the future of .NET. Right now, this future is the open-source, all-in-one .NET 5.

Why so much emphasis on the “all in one” part? Despite .NET officially being a single framework, in its current version 3.0 state it’s still a combination of several distinct parts that don’t always get together well: Core, Xamarin/Mono, and Framework. This creates certain hindrances in terms of the interoperability of .NET parts, and of the apps built with the C#/.NET/Visual Studio development stack.

Scheduled for release in late 2020, .NET 5 is to address these issues by merging the .NET Core and .NET Standard parts of the overall framework. Whatever it might bring on, the consolidation of .NET products into “just one .NET going forward” as the press releases often name it, ambitiously marks Xamarin to be reborn. The time and future updates will show in what capacity exactly, though.

2020 will be a year of big changes for .NET platform as a whole. What will it mean for Xamarin mobile development though?
Tweet

In Conclusion

Having many options to go about things can sometimes be disorienting, but usually having choice is good. Competition gives platforms an extra push to release more options and become better. It also gives app developers ways to find their preferred tooling and development environments.

Xamarin isn’t only a choice in itself. It also provides further choices within the framework. Its biggest strength lies in its flexibility. You can pick Forms for maximum code shareability and reusability, or, if need be, try and use Xamarin.iOS/Android for fully unique solutions that can embrace almost all specific capabilities of each platform—without ever needing to touch Objective-C, Swift, Java, or Kotlin.

Content type
Blog
Build great mobile apps with Iflexion.
Contact our team for a free consultation

WANT TO START A PROJECT?

It’s simple!

Attach file
Up to 5 attachments. File must be less than 5 MB.
By submitting this form I give my consent for Iflexion to process my personal data pursuant to Iflexion Privacy and Cookies Policy.