Uno Platform, developed by nventive based in Canada, is an open source project allowing modern .NET developers to create applications with a single codebase using XAML and C# targeting Modern Browsers like Microsoft Edge with WebAssembly, plus iOS and Android are also supported.
Finally, the Universal Windows Platform can also be targeted, and the Uno Platform is aiming for 1:1 compatibility with it. Developers already familiar with XAML development using Windows Presentation Foundation (WPF) or Universal Windows Platform (UWP) can take advantage of their existing skills.
Architecture
Uno Platform architecture supports Universal Windows Platform which runs directly against the Windows 10 API and with full support for Visual Studio tooling. Uno Platform also supports WebAssembly implemented in modern browsers such as Microsoft Edge, Google Chrome, Firefox and Safari to render using HTML and CSS with code running on Mono.
Uno Platform also allows for native library support for iOS with UI Kit and Android with Android UI using Xamarin for native API bindings. Uno Platform provides native performance for all supported platforms.
Platform
Uno Platform requires Visual Studio 2019 for Windows with the Universal Windows Platform, Mobile Development for .NET and the ASP.NET and Web workflows. If you want to target iOS, you will also need a device running macOS to run the iOS build host.
Once you have the prerequisites you can then install the Uno Platform Solution Templates from the Visual Studio Marketplace.
API to native mapping allows Universal Windows Platform APIs to map to native APIs and controls on every supported platform using platform specific APIs.
Don't need know the platform specific APIs just use the Universal Windows Platform interface and it is all done for you, for example the TextBlock becomes HTML Paragraph on WebAssembly, UILabel on iOS and TextView on Android.
Playground
Uno Platform has the Uno Playground available at playground.platform.uno allowing you to easily try components with snippets, use the XAML editor to directly input anything, set a Data Context to try out data binding and see a live preview of anything created.
Uno Playground is an easy way of seeing what's possible with the Uno Platform as it runs using WebAssembly in most modern browsers without needing to install anything else.
Example
Uno Platform to get started requires Visual Studio 2019 to be installed, if not download and install Visual Studio 2019 Community from visualstudio.com. Then you just need to make sure that your Visual Studio 2019 installation has the Universal Windows Platform development, Mobile development with .NET and the ASP.NET web (including .NET Core 2.2) workloads installed.
Once Visual Studio 2019 has been installed, start it and choose the “continue without code” option at the bottom of “Get Started”. Once Visual Studio 2019 has started, in the menu choose Extensions, Manage Extensions then search for and install the Uno Platform Solution Templates. To develop for iOS, you will need the iOS Remote Simulator plus access to a Mac with Visual Studio for Mac and XCode 8.2 or later installed. To develop for Android, you will need Android Studio installed and any Android x86 Emulator or access to a physical Android device.
You can then create a simple example using the Uno Platform:
- In Visual Studio 2019, select File, New, then Project to Create a new Project, then search for Cross-platform App (Uno Platform) and select Next.
- Then in Configure your new project enter the project name as HelloWorld, choose a location to save and then select create.
- Then once created, select HelloWorld.wasm from the dropdown of projects in the toolbar and then select IIS Express to start debugging the project.
- Finally, your web browser will start allowing you to see the output from the application of "Hello World".
Summary
Uno Platform delivers Universal Windows Platform features and functionality to iOS, Android using Xamarin and to modern browsers using WebAssembly.
Uno Platform makes it easy to get started by trying out the Uno Playground online, then once ready install Visual Studio 2019 and related development tools and templates to start creating apps with Uno Platform.
Uno Platform makes it simple to create cross-platform applications using existing, or newly acquired XAML and C# skills to target Windows 10, iOS, Android and modern web browsers.
Uno Platform helps make it easy to develop applications that can share common code and functionality for multiple platforms and take advantage of upcoming devices as the platform matures such as Surface Neo - Microsoft's dual-screen Windows 10X tablet, or even Surface Duo - Microsoft's dual-screen Android phone.
About the speaker
Peter Bull is a Senior Platform Developer at Tombola based in Sunderland.
He's been working in software development since 2000.