Hi friends, welcome to another blog post about my favorite Framework. Today we will dive into less technical stuff. We will talk about how Xamarin Forms evolved. How Xamarin Forms moved away from its reputation of a framework used to build only prototype applications to a robust cross platform framework which is now used to build real-world good-looking applications with fancy UI if necessary.
Xamarin Forms is a framework which is used to build cross platform native phone and desktop applications. It permits developers to leverage the power of .Net across every platform it targets (iOS, Android, Tizen, tvOS, watchOS…)
Though Xamarin Forms is now far more robust and reliable, not long ago it suffered from its reputation of a framework with poor tooling, long build times and several other draw backs. I have to admit that though I love the .Net framework, my first experiences with the “old” Xamarin Forms was not the best. I even wrote a blog post about the issues I faced and their solutions. But now, Xamarin Forms evolved to a higher level thanks to the Xamarin team and the community. Let’s dive in.
Today we have tools like hot reload, hot restart for iOS, the Xaml Previewer, and a far better debugging experience in visual studio and visual studio for mac.
Let’s go back before the hot reload and all the like. In 2016, The XAML previewer was announced as part of visual studio. This was an improvement brought to visual studio which permitted developers to preview their UI code into a built-in widget in visual studio known as the XAML previewer. Though this was better than blindly coding the user interface, it wasn’t enough. You had to provide design time mock data to visualize what would be your user interface and it had several other floors.
In 2019 the Xamarin team announced XAML hot reload which enabled developers to code the UI and view changes in real-time on the emulators and devices. Today this hot reload is integrated directly and you have no additional setup to do. Though there were a few commercial solutions like the hot reload, the solutions I tried were less efficient than what we have today by default when building Xamarin Forms apps.
Today there are many other tools at your disposal which make development easy, like Hot Restart (preview on iOS), the possibility of dragging controls in visual studio directly into XAML, Faster startup time in Android with startup tracing, Faster builds, Intellicode with Xamarin Forms XAML etc …
The Shell simply put is a way of structuring your entire application. This approach is very opinionated and comes with several goodies to facilitate the process of scaffolding your entire application, implementing navigation. Xamarin Forms 4.0 brought us the shell, which really improves application development. Scaffolding an application is extremely fast. I wrote an article about the good things which the Xamarin Shell brings to us several months ago you can check it here. At first, you had the possibility of building your app from scratch, using tabs or master detail pages… These where good and they can still be used today, but the downside was that you structuring your whole app was not an easy task, you had to manage navigation etc… The shell removed all of these difficulties and made it extremely easy to scaffold your entire application with just a few lines of code. It handles navigation in a more efficient way than before, providing you the possibility to navigate via routes and pass parameters.
When you use Xamarin Forms and you understand how it functions, you clearly see that Xamarin Forms was built with the idea that it should provide a common denominator of what was available on the platforms it targeted. For example, some controls where not available in Xamarin Forms because they were not present natively on specific platforms or on every platform. Examples of these controls include (The checkbox and the Radio button).
The latest releases of Xamarin Forms go away from this ideology and this is awesome. You could witness this with the release of Xamarin Forms 4.1 we had the checkbox control. And coming soon, the radio button will be available despite the fact that these controls are not present by default on iOS.
Xamarin Forms makes .Net developers feel at home thanks to XAML and C#. And as we all know, the main design pattern used to build apps with C# and XAML is MVVM. Despite the fact that MVVM is great and it allows good separation of concern and many other advantages (which I won’t mention here), not everybody is familiar with it. Xamarin Forms is easy to get started with for .Net devs but what about other developers from different backgrounds? like web developers who are used to PHP, Ruby e.t.c ? As a developer who comes from another world, I would want to use the skills I had in the new world I’m going to, and not have to re-learn everything from scratch.
Though this is still in the experimental phase, As explained in this blog post, this problem is being tackled by bringing blazor mobile bindings for Xamarin Forms. Basically, this provides a way of building mobile applications using the MVU pattern, very similar to what web devs commonly use. What is blazor? Blazor is an open source framework used to build web applications using C# and the razor syntax, learn more about it here. Xamarin Forms also permits you to style your UI with CSS instead of XAML and this is really advantageous for web devs.
Xamarin Forms Evolved in this aspect too. Xamarin Forms is known for providing native look and feel for the platforms it targets. But with Visuals, you can provide consistent look and feel for every platform. We devs currently have at our disposal Visual Material design for several controls, and the possibility to create our own visual renderer for native controls. You can learn more about visuals here.
There are several things which you had to repeat when building new apps with Xamarin Forms. This made the development process longer for minor tasks. These included setting the maximum length on an entry, setting fonts as image source, adding fonts to each project… Just to name a few. These have been gradually taken care of and it is great. We now can build faster without taking care of such minor issues.If this post was useful to you, please share it and follow me on Twitter, Github or like my Facebook page.Follow me on social media and stay updated
We went through a few points highlighting how Xamarin Forms has evolved and the most important thing to note is that it continues evolving. With new releases every 6 weeks and a lot of engagement and improvements, this framework keeps getting better and increases productivity. If you have any point in which Xamarin Forms has evolved, I invite you to share your opinion in the comment section.