Web apps with Xamarin.Forms

Table of Contents

Web apps in Xamarin Forms is one of the most striking features for developers over time. There are many articles and presentations that talk about this topic, but we will focus on the different alternatives that exist today and one or another surprise.

That’s right, there are different alternatives! Join me and let’s see it together.

Web apps in different ecosystems

.NET Ecosystem

When we talk about web applications within the .NET ecosystem the first thing that should come to mind is ASP.NET Core because it is the most stable and the best alternative so far; that’s why I’ve placed it at the beginning of everything.

Tip

The idea at this point is to be able to use the same business logic of your app in both your Xamarin.Forms project and your .NET Core project. With this, you would only be using your web project to work the User Interface.

If you use some architecture pattern, such as clean architecture or other, it shouldn’t be difficult to integrate these projects seamlessly.

Another very important thing to note is that if you use Razor Pages, or Blazor, with MVVM the integration can be much more fluid since you will have a similar architecture in your projects.

It’s also good to mention that developers who don’t have web experience with .NET will have a small learning curve with the entire ecosystem.

The good thing that developers who do not have experience in web use this alternative is that they will become familiar with Blazor and this will help them a lot for those who want to use .NET MAUI and Blazor.

Web apps with Xamarin Forms

UNO platform

UNO platform has taken the mobile apps with Xamarin.Forms and placed them on the web via WebAssembly using a single codebase.

Curiosity

Uno Platform has the uniqueness that it is focused on Universal Windows Platform (UWP) developers.

With this they ensure, according to them, the future of the WinUI stack because it can run anywhere – WebAssembly, iOS, Android, and Windows.

 Important

In order to build your wasm (WebAssembly) projects, you have to have a UWP project. This makes it platform-dependent, and in many cases, we may not have support from some UWP libraries; with which you have to analyze the needs well before you can use this option.

More in this thread:

Testing @UnoPlatform in #XamarinForms and I’m seeing that the wasm project depends on the #UWP project to compile.

Am I missing something? @ajpinedam pic.twitter.com/immPwhdvg4— Luis Matos (@luismatosluna) June 13, 2021

Regardless, we can say that Uno platform is the best alternative for creating web applications with Xamarin.Forms from a single codebase; of that, there is no doubt.

Ooui Web Framework

Ooui (pronounced weee!) It is a small cross-platform user interface library for .NET that uses web technologies. With Ooui, you get all the power of your favorite .NET programming language, plus the ability to interact with your app using any device.

If with Ooui we can build our applications directly on the web sharing the same user interface and business logic. A wonderful initiative that we hope can continue to evolve on .NET Maui.

 Important

To mention is that not all controls are supported, so if you need something outside of the most basic controls created you will have to create them.

 Warning

I would not recommend this alternative for production. At least not for the moment.

Hybrid applications with .NET Maui

In the release of .NET MAUI preview 4 (if you haven’t seen it, I’ll leave it here)we were shown what BlazorWebViewis. With BlazorWebView we can host a Blazor web app directly in our .NET MAUI app to work locally while leveraging the built-in features and UI controls of the native platform.

Tip

This can be convenient for those who want to use .NET Maui Blazor, so they would only use a single stack.

Wait there’s more!

If you want to use any web application within the .NET ecosystem with MAUI then you should follow this ISSUE. If you are developing a mobile application with .NET but the web stack is different, if you create this control, you can use or reuse that stack, technology, or code to use it within a mobile application with .NET MAUI.

Resources

Share this content!

Facebook
Twitter
LinkedIn
Telegram
WhatsApp