Xamarin.Forms 4.0 – Making App Development Easier Than Ever
Microsoft has been listening to its customers once again and, based on a huge amount of feedback, has now released Xamarin.Forms 4.0. The aim was to improve productivity by reducing the complexity of building cross-platform mobile applications. The result is an update full of amazing new features to help streamline development.
What is Xamarin.Forms?
While Xamarin is able to deliver mobile apps with a shared code base for the application logic, the user interface still needs to be written separately for each platform. It is Xamarin.Forms that abstracts the user interface from each platform and combines them into a common layer. As a result, with Xamarin.Forms it is possible to build apps that have both a shared application layer and a shared user interface layer.
As a cross-platform UI toolkit, Xamarin.Forms gives developers the ability to easily create native user interface layouts that can be shared across iOS, Android and UWP. With over 20 cross-platform controls, the toolkit is an incredible resource for developers providing:
- Several different page layouts
- The means to layout controls within pages
- A binding engine to link a property in a class to a property on a control
- A messaging service enabling classes and components to communicate
- Utilities to access the underlying platform projects
- Effects to create small platform-specific user interface tweaks
- Custom Renderers giving full control of appearance and functionality
With undeniable success as the leading platform for cross-app development, it would be easy to rest on their laurels. However, the Xamarin team are quite honestly obsessed with feedback. They conduct countless interviews, conversations and surveys to ensure they make the updates and improvements that users want. Over the past year, they have listened to the feedback, and the update has aimed to make Xamarin.Forms:
- Easier to use ‘out of the box’
- Simpler to control with a navigation that is always present
- More consistent in design across iOS and Android
- Faster and more flexible in terms of list control
A preview of the update, released at the end of 2018, has enabled the team to fine-tune the update to Xamarin.Forms and make the necessary adjustments to deliver on its promise of simplicity.
Xamarin.Forms 4.0 – New Features
The new version of Xamarin.Forms is a simplified, navigation-aware framework, aimed at making building mobile applications more efficient than ever. In a lot of ways, the update looks like a Microsoft-focused take on Flutter, Google’s Mobile App Framework. Either way, the new features have delivered in reducing the complexity of building cross-platform apps. The main highlights of the update are Xamarin.Forms Shell, which includes fundamental app architecture features, VIsual and CollectionView.
To deliver on its promise to make Xamarin.Forms easier to use ‘out of the box’, Shell has been developed. Ideal for newcomers, Shell offers a heap of bootstrapping so users can jump in and focus on content and features. Everything is template-based, so you don’t need to learn any new skills or tooling, and it looks great from the outset while also being fully customizable.
Shell reduces the complexity of mobile app development by providing the key features that most mobile applications require. This is achieved by allowing the structure and navigation of an app to be more easily expressed in a single file. The feature uses three tiers of elements, evolving the existing MasterDetailPage, NavigationPage and TabbedPage to deliver:
- A single place to describe visual hierarchy
- A unified navigation user interface
- Deep linking within the navigation
- An integrated search handler
While on the surface, Shell provides an incredibly simple syntax for an app’s menus, it also provides a powerful URI-based navigation scheme. Underneath the surface, all renderers implement the ‘fast renderer’ pattern. The architecture included in Shell paves the way for the future of Xamarin.Forms, enabling more expressive animations, transitions and interactions.
One of Xamarin’s core aims is to create a native look and feel cross-platform. Visual is Xamarin.Forms’ new way for developers to produce consistent UI designs across cross-platform apps. The tool simplifies the arduous task of tweaking native projects through the use of styles, effects and custom renderers to create a unified look. Visual provides a consistent control by default and goes further by unifying behaviour as well as styles.
Working like a templating engine, Visual allows you to specify the theme of your app using design languages such as Material, Fluent, and Cupertino. Using Visual, the Forms libraries use different renderers to draw the controls, meaning that you can achieve consistency in terms of look and also user experience.
CollectionView has been designed to resolve the issues that users have encountered with its predecessor ListView. CollectionView offers flexible and powerful list control by reducing complexity and increasing functionality. The problem with ListView is that, when not implemented correctly, it easily caused performance issues and was lacking certain features.
One of the main improvements with CollectionView is that it works by having no concept of cells. Instead, data templates define the appearance of items in the data list. The feature also offers a flexible layout model. In short, CollectionView does the same thing as ListView, but better:
- Lists can be created to scroll horizontally or vertically
- Columns can be specified so items are shown side-by-side
- Granular scrollbar progress allows you to interact whenever a user is scrolling
- An empty state DataTemplate can be specified to tell the user when there is nothing to show
- The API surface is reduced
As well as the bigger improvements, there are also a lot of smaller ones included in the new release, with many bugs being fixed. For example, Android fast renderer has become the new performance standard for renderers within Shell.
In summary, Xamarin.Forms 4.0 seems to have delivered on its promise to facilitate consistent design across the major mobile platforms. The new navigation features and its new approach to adding visuals to controls all facilitating easier, consistent and flexible app development.