Summer Xamarin Forms

Quentin Lee - 16 September 2018

This summer I decided to start writing apps using Xamarin Forms after writing all my apps in Xcode. Xamarin is a framework where you can build apps across platforms without rewriting a lot of the code.

I learned Xamarin pretty quickly. In 1 hour I already learned the basics of Xamarin. So I decided to create an app containing several utilities for mathematics and chemistry.

Programming such an app wasn't a big challenge, so I also decided to learn about the MVVM design pattern which is very easy to use in Xamarin. Using this design pattern you have a viewmodel containing the data of a view. Using binding you can connect objects of the view with properties of the viewmodel. For example you can bind a text label with a string property. Changing the string property should also change the text label text. Using this design pattern, I tried to develop my new app.

Using this design pattern wasn’t very difficult. In my opinion, it was even easier than the way I developed apps in Xcode. I didn’t have to check if input fields are edited by the user, because with binding the property connected to the input will change with the input. After some experimenting I could also recalculate other values when changing the input value. For example, 1 utility of the app is an ABC-Formula calculator. Every time the user changes the input of a, b or c, the program tries to recalculate the answer of the current equation. This way the app uses an efficient way to update values real time.

At first I was very positive about Xamarin, until I tried to deploy the app to my iPhone and deploy the app to the AppStore. When deploying the app to my iPhone, it just crashes immediately. After lots of research I found out the current version of EF Core wasn’t compatible with the current version of Xamarin iOS, so I had to use an older version of EF Core. The problem with deploying to the AppStore was that the app size was about 110 MB. Similar apps built from Xcode had an app size from about 10 MB. I figured it had something to do with linking libraries. I had to link libraries so the app would only contain the code of the libraries the app actually uses. Using linking brought the app size down to 40 MB, but I was not able to lower it more. The app I am talking about is already in the AppStore. If you’re interested, you can find more information about the app here.

Using Xamarin Forms has been a great new experience. I learned about the MVVM design pattern and using EF Core(which I will talk about in another blogpost). After only seeing the advantages of using Xamarin Forms I also saw some disadvantages, like too large app sizes and dependencies which are not compatible with the current version of Xamarin. After all I would still use Xamarin Forms to develop relatively simple apps, but when apps are getting too complex I think it is better to build native apps for each platform.


Add a reaction