What I like about Xamarin.Forms 2.0: Precompiled Xaml

This is the first post about the new features included in Xamarin.Forms 2.0, released with Xamarin 4 a week ago.

In the previous versions of Xamarin.Forms when you made some mistakes in XAML, like a wrong property or a wrong value, you can’t catch the error until start a new debug session. Xamarin.Forms 2.0 adds a new attribute that allows checking XAML at compile-time. You have only add that code in the AssemblyInfo.cs file:

using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]

Now you got a compile-time error in case of wrong XAML:

Schermata 2015-12-08 alle 08.47.19

XamlCompilation and Xamarin.Forms performance

The compile-time xaml check is not the only benefit of XamlCompilation. Precompiled XAML will produce a smaller app file, since the XAMLs are no more embedded, and thus a much more fast app by removing the XAML load time.

Amazing!

Found a problem? Edit this post