© Gerald Versluis 2017

Gerald Versluis, Xamarin.Forms Essentials, https://doi.org/10.1007/978-1-4842-3240-8_9

9. What to Expect in Xamarin.Forms Version 3

Gerald Versluis

(1)Sittard, The Netherlands

As I was writing this book, the next major release of Xamarin.Forms, namely version 3, was looming. By the time you are reading this, version 3 will have probably made it to production. That means that some of the features I describe here are probably available to you right now.

Other features might be pushed back or dropped. Xamarin has communicated the features covered in this chapter, so chances of them being dropped aren’t great. But still, be aware that this is all in the future as I write, so no guarantees!

You can see the full roadmap on the Xamarin Forums at https://forums.xamarin.com/discussion/85747/xamarin-forms-feature-roadmap/p1 .

Improving Performance

The focus of version 3 of Xamarin.Forms is performance and stability. The team at Xamarin has learned a lot and has a few tricks up their sleeves to improve things here and there.

Fast Renderers

As you learned in Chapter 2, Xamarin uses platform renderers to achieve the translation from abstract controls to native ones. This is where most of the heavy lifting is done, so they are looking at where they can identify bottlenecks and remove them.

Especially on Android, performance can be problematic. For this, the Xamarin.Forms team is creating special fast renderers. These special renderers will reduce inflation—a concept used on Android to construct controls—and cut back on rendering time by flattening the nesting of controls.

The best thing about these renderers is that you do not have to do anything special to use them! Over time the “old” renderers will be replaced by the fast renderers, one by one. The first tests report up to two times faster rendering.

The ListView is always under heavy fire because it can hold an unlimited number of rows and can become slow, very quickly. With the new optimizations for this in place, scrolling should be a lot smoother with these new renderers.

Of course, all of this is still subject to the hardware, OS, and other factors that are being used.

Layout Compression

Xamarin.Forms is all about the elements and layouts, so logically, that is where we can still gain a lot on performance. One thing that helps already is enabling XAML compilation, as discussed in Chapter 6.

Layout compression is an addition to this. Not very much is known at this point about this feature, but it’s said that when this is enabled, layouts will be optimized at compile time. This will improve render times and lower memory usage.

The way the Xamarin.Forms team wants to achieve this is by compressing multiple layers of Xamarin.Forms layouts into a single native view.

XAML Standard

Chapter 2 covered XAML in the WPF context. You learned that the naming is inconsistent between Xamarin.Forms and WPF (and UWP apps, for that matter). Now that everything XAML-based is back at Microsoft, efforts have been made to unify all the dialects. This is called the XAML Standard.

This means that, when a platform implements a certain version of the XAML Standard , you can use that XAML everywhere else that supports the same version. Basically, this is just like how .NET Standard works. In the future, this will mean you can write the same XAML for your Xamarin apps, WPF apps, UWP apps, and who knows what more is to come! Although I still think you should look at your layouts critically when porting from one form factor to another, this will be a big asset when porting.

You can read more, and even participate, on the specification on GitHub at https://github.com/Microsoft/xaml-standard .

More Styling Options

I believe this feature has moved back to the backlog for now, but at least it is still on there. Xamarin is looking into a more CSS-like styling syntax to be integrated into Xamarin.Forms. Not much is known about this feature, especially since it is being pushed back, but it sounds very promising! It would be great to have some of the great stuff that is available in CSS today, right in Xamarin.Forms. This will allow us to implement styling easier and maybe even theming capabilities for our apps.

Technically not styling, but it’s right there on the same shelf is the introduction of the FlexLayout system . This is a very popular engine in the web development world. If you aren’t really into web development; the FlexLayout system provides a way to efficiently lay out, distribute, and align space among items in a container. This also works for elements with an unknown size, hence the word “flex”.

Read more about the use and workings of FlexLayout at https://www.w3.org/TR/css-flexbox-1/ .

Xamarin.Forms Embedding

As you have seen earlier in this book, there is a simple way to use native controls directly in Xamarin.Forms, called native embedding. Now, the folks at Xamarin are introducing the opposite, called Xamarin.Forms Embedding. You can now also incorporate Xamarin.Forms controls into your traditional Xamarin apps!

This allows for all kinds of scenarios. Maybe you want to turn your traditional Xamarin app info a Xamarin.Forms one, but you don’t have the resources to do it all at once. With Xamarin.Forms Embedding, you can do it gradually. Or maybe you just like that one control that Form has to offer; now you can use it.

Also, all other Xamarin.Forms goodies—like DependencyService, MessagingCenter, data binding, etc.—will work as well.

More Supported Platforms

With the basics now implemented, it is time to spread out across more platforms. The usual suspects are covered—iOS, Android, and UWP—and now they are moving on to MacOS and GTK#.

GTK# is a .NET wrapper for GTK+, a UI toolkit mainly used on Linux systems. This means that you can bring your Xamarin.Forms app to a variety of Linux distributions in the near future.

Did you know that you can already run Xamarin (Note: not Forms!) on platforms like PlayStation 4, Xbox, Google Glass, Amazon Kindle, and Linux?

Others

There is a lot more to come in this next version and the ones after that. To name a few—:globalization support, accessibility improvements, more gesture recognizers, and full support for .NET Standard 2.0. I could go on for a while.

The reason I don’t describe these in more detail is simply because there isn’t more detail available right now, but it seems that Microsoft has great plans for Xamarin and they seem to focus heavily on Xamarin.Forms specifically.

One more good thing to note is that support for Windows Phone 8 and 8.1 is being dropped as soon as possible. This platform isn’t maintained by Microsoft anymore and removing support for Windows Phone from Xamarin.Forms should improve the startup times for apps built with Forms.

Summary

It looks like Microsoft is investing heavily on the development of Xamarin and especially of Forms. If you don’t have any experience with it right now, I hope this book will inspire you to look at this great ecosystem and everything it has to offer.

This chapter peeked into the future of Xamarin.Forms and highlighted a couple key features that will be part of the upcoming major version of Forms.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.210.229