Our Discord community is buzzing. Come and join us!

Just recently I have converted one of my UWP games to Uno Platform – The Minesweeper 10 and I wanted to share my experience. In just about 4 hours I was able to have it run cross-platform on iOS, Android and Web!

The Challenge

I have developed many apps and games using UWP. To date I have almost 5 million app downloads in the Microsoft Store which are played by thousands of users on daily basis. To keep my development going most of my games use Ads for monetization. Unfortunately for me, and developers like me, in February Microsoft announced that they would stop supporting Ads in UWP in June. This would mean that I would lose most of my income and that I needed to act fast.
In addition, I regularly get emails from my users asking if my games are also available on Android and iOS. They were not, which always made me feel like I was missing out on a bigger opportunity to monetize the work I already did for UWP and will continue with WinUI.

Moving Minesweeper and other UWP apps

I made the decision to try to move my apps to Android and iOS as I believe (hope) those platforms will still generate descent ad revenues. However, I didn’t want to rewrite all my code. So, building native apps for those platforms wasn’t an option. I am used to in UWP and nowadays WinUI XAML dialect which is why I chose Uno as its XAML is just UWP/WinUI XAML and the code is off course just C#. The option to run the app using WebAssembly in a browser was a nice bonus as I can just create PWAs with Uno too.

Minesweeper 10

One of my smaller games in Windows Store is Minesweeper 10 so I picked this app to be my first Uno app. The app doesn’t have too many features so it would be easier to start. I even dropped some features like the Menu, Options, Highscores and Statistics in order to get to market faster. Only the beginner gameplay (9×9 with 10 mines) would be enough because the games would be played the most on a small phone screen.

The Conversion

The conversion itself was quite easy.

  1. I just downloaded the Uno templates and created a new visual studio project with it.
  2. I copied all files from my UWP app into the Shared project.
  3. Then I compiled the project for the first time. I got a lot of errors and warnings. The app is developed using the MVVM design pattern. It uses a lot of databinding using x:Bind. The version of Uno I was using at the time (Uno Platform 2.0) didn’t officially support x:Bind at the time, and later released it in version 2.1. However, the beauty of developing in the open is that Uno team was already working on it and I was able to use the ’dev’ (prerelease) version on NuGet which supported x:Bind so I could continue working. Also, an upgrade to Uno 2.1 fixed that later.
  4. I also used some x:Bind in events, which are not yet supported in Uno but are slated for version 3.0. But this was something I could easily fix by implementing normal eventhandlers from which I called the binded methods.

One thing to note – I also got a lot of Uno0001 warnings which are caused by using features in my UWP apps which are not (yet) implemented on one of the other platforms. I was using methods like FileIO.ReadTextAsync() and FileIO.WriteTextAsync(). This functionality was used to store gamestats when you exit the game and restore it when you restart it. For now, I just removed this feature. For the time being you always start with a new game.

In the original UWP app I had two Lottie animations (Explode & Complete) for which I had used the Windows Community Toolkit. To make it easier for me for the first iteration of the app I replaced it with a BOOM and YEAH image and will look into Lottie animations in the future as Uno supports it as well

Within a few hours I had the app running!!

Before publishing the apps to the Google Play store and the Apple Store I had to do some finetuning for which you should be prepared for as each store comes with its specific asks
1. I had to create all the assets (Images, screenshots, tiles) for each of the ‘Stores’.
2. I also added a custom Splash Screen using this very useful blog from Martin Zikmund.

To be honest, I spent the most time on publishing the apps to the stores, as the conversion itself took less than 4 hours. I’m very familiar with this process for the Microsoft Store. However, the Android and Apple stores work quite differently. You have to read a lot of documentation before you know how it works.

The Result

The original UWP Windows app can be downloaded from the Microsoft Store

The Uno Android app can be downloaded from the Google Play Store

The Uno iOS app can be downloaded from the Apple App Store:

The Uno WebAssembly (WASM) version can be played on: https://minesweeperuno2wasm20200507111319.azurewebsites.net

I even added a PWA manifest file so you can install it on your computer.

Fons Sonnemans
Trainer, speaker, developer, mentor | Microsoft MVP

Uno Platform 5.2 LIVE Webinar – Today at 3 PM EST – Watch