Microsoft may have ended their support for native mobile applications, but they continue to promote platform-agnostic solutions for development teams. After their purchase of Xamarin in 2016, Xamarin.Forms has seen considerable growth in popularity, and since .NET Standard and .NET Core provides an easy and intuitive way to create and manage libraries for all target platforms, C# has quickly become one of the most recommended languages for developing scalable and high-quality applications.
However, this does not mean that all is good for Team Microsoft. Android and iOS still have a cult-like following of developers when it comes to creating native applications through Kotlin and Swift respectively, while cross-platform solutions like Flutter and React Native can brag about not needing an IDE and a heavy tool set to do what Xamarin.Forms does. Progressive Web Applications are in a zone of their own, where JavaScript-driven, well-crafted web applications that look and feel like native applications are attracting businesses.
Microsoft, in order to give direction to developers with respect to .NET and UWP (Universal Windows Platform), has been attempting to thin the line between older Windows SDKs and UWP, while at the same time bringing everyone into a future where they want .NET 5/.NET 6 to reign supreme.
A new framework emerges
Perhaps the easiest way to understand Uno would be as an alternative to Xamarin to develop applications in .NET that can run on iOS, Android, and Web. It advertises itself as a framework used to “Build native-like applications for Web and Mobile using C# and XAML”. Although this does not sound like anything new, Uno’s website does provide a comparison table that showcases how different it is from existing cross-platform frameworks.
The Uno Platform relies on Xamarin Native stack (not to be confused with Xamarin.Forms) for Android, macOS, and iOS, which will be a part of .NET 5/.NET 6, on Mono-WASM for WebAssembly, and on Skia to draw the UI on canvas for Linux. It provides the ability to run a single codebase (C# and XAML) on all platforms. It builds on top of Xamarin, i.e. Xamarin Native/Xamarin Classic (Xamarin.Android, Xamarin.iOS, Xamarin.macOS in order to support Android, iOS, and macOS platforms) rather than Xamarin.Forms, although the renderers for Xamarin.Forms can also extend Xamarin.
The platform acts as a bridge for UWP and WinUI applications to run on macOS, Android, iOS, WebAssembly, and Linux natively. The C# and XAML source code can run without being modified, get compiled on different platforms, and yet at runtime will behave the same. The Xamarin app development team also benefits from the Windows ecosystem which has had decades of investment in security, accessibility, responsive design, etc.
The applications can be deployed like any other applications through the Google Play Store or Apple App Store for Android, iOS, and macOS, and even as PWAs if required. For the Web, they can be deployed using Azure Web Apps, Azure Static Web Site, Github Pages, or any static web-hosting provider and CDNs.
The Uno platform uses UWP/WinUI 2D directives in order to draw the UI by default. It takes care of pixel-perfect look by either using the underlying 2D primitives or Skia to draw each pixel. Uno also has an option to use native UI elements for Android, macOS, and iOS which enables the developer to implement tighter integration as and when needed. XAML styling can be used for this purpose, on individual controls on the screen.
Uno also advertises itself as the only open-source platform that helps in creating multi-platform applications that are truly single-source. It claims that 99% of the UI and business logic gets reused across all target platforms. Some of the features that enable code and skill reuse are mentioned below:
- IDE – Visual Studio, Visual Studio Code and JetBrains Rider can be used as the IDE.
- XAML Hot Reload – XAML Hot Reload is a feature that allows developers to modify the XAML display in an application that is already running, making iteration faster on Data Binding and UI changes.
- XAML, C# Edit and Continue – Lets developers edit the code, set any new properties, or add any new code and run without ever having to restart the whole program.
- Code Reviews – Integrations with Gitpod and Codespaces save time for developers when it comes to reviewing pull requests.
- Prism Library – Takes advantage of time-tested, development practices and proven patterns to create applications.
- Lookless Controls – The look-and-feel is implemented in XAML, while the control functionality is contained in a class file. This gives greater control to the developer in order to render pixel-perfect UI.
- OOTB (Out of the box) Responsiveness – Assets get automatically retargeted, reducing pressure on designers.
- Testing – For Web applications, Selenium can be used for testing purposes while for Mobile applications, AppCenter and Xamarin.UI Test are available.
Conclusion
Although Uno is still in its infancy, the sheer number of features available makes it extremely promising and there is no question that in due time it can become the defacto choice for development teams, thanks to the Uno Platform team’s continuous efforts!
Reference: Uno, Hackernoon, InfoWorld, Newsbreak, Visual Studio Magazine