Xamarin, Xamarin, Xamarin… yesterday I was treating it as my nightmare. Today I am loving it and feeling great about it. Some of you may ask what has changed between those two days?
As some of you may know, Xamarin is a cross-platform development software. It allows you to build a hybrid app which can be run on Android & iOS & UWP. What is special about the Xamarin is the fact that you can write your business logic once. Sounds like a developer daydream? Almost.
There are two versions of Xamarin. Xamarin.Native and Xamarin.Forms. In each of them, you are writing in C#. Depending on your operating system you can either write in Visual Studio (Windows), or Visual Studio for Mac, or Visual Studio for Linux (thanks to Microsoft for going opensource!). That’s a nice thing. Little to nice. So here is kind of a bad one: you need to keep in mind, that when developing apps on Windows or Linux, you won’t be able to easily build an app against iOS. Still, you can do it, but in this case, you will need to have a build server (never done that). The build server is just a Mac computer which is connected to your computer and you use it to build the app on iPhone.
Let’s say you know C# and you heard about Xamarin. You want to make an app. Doesn’t matter why you want to do it. Either you want to learn something new or want to do an app for yourself, or your friends — it is up to you.
You are full of energy, coming back home, sitting in front of your computer, opening Visual Studio, starting a new project and… kaboom. Which should you choose? Xamarin.Forms or Xamarin.Native?
The difference is that in Xamarin.Native you are developing views/pages per platform and on Xamarin.Forms (ideally) not. In Xam.Native, for Android app you will be using .axml file (Xamarin’s version of android .xml files), and on iOS, you will be using storyboard. But behind all of your views, there will be one logic put in one place. On the other hand Xamarin.Forms allows you to write everything in one place. You can write your BI logic and views once.
So what is the difference? — some of you may ask. Let’s make a small table presenting the difference between 3 approaches: developing native apps (Java/Kotlin + iOS), developing Xamarin.Native app, and Xamarin.Forms. I hope that after all, you will understand is best for you or your business.
Aaa, had to do it like image, cause no way to make a table in Medium..
As you can see everything depends. Depends on UI, budget, delivery time etc. If you really want to make an app and don’t know what to choose then ask yourself a few questions:
* do I need iOS and Android version? or only one will do?
Let’s say you want to make an Android version only. Here you can either choose Java/Kotlin or stick with C#. If you don’t have in your mind making an iOS version, go native. You will achieve much more in there. If you are thinking about making only iOS version — still go native. This will allow you to do some fancy UI things which will be pretty quick.
* I want to have both iOS and Android and I know how to create layouts in .xml and in storyboards
If the delivery time and budget matters then go Xamarin.Native. If not go Native-native. Also, you have to think longterm: if you are thinking about maintenance of the app then choose Xam.native cause it will be cheaper.
* do I need it right now? do I care about performance and fancy animations? do I have only a few dollars for it?
If you’ve answered yes to the above then Xamarin.Forms is a perfect match for you! We (as a Xamarin.Forms developers) can get you an app pretty quick. We can do it at a price lower than native. We can maintain it and it won’t cost you a fortune. We can do it, but… as some once said to me Xamarin is still a new child. It is still a bit childish so you can’t expect it to behave like grown-ups (native solutions)
Let’s say I had a client. He came to me asking if I can make him an app. “Sure” — I’ve said. Must say that he was kind of prepared cause he already had the designs. The second thing he said to me is that they have limited budget (very small budget to be specific) and they want iOS and Android. I thought like “ha, that’s great. I will show them Xamarin is great — we will do it this way”. Then I opened the provided designs. Each time I was opening a new page I was feeling nervous (btw: chapeau bas Tomek for this design I am still admiring them). There was not a single native control. Each of them was custom. After seeing custom vertical slider (pretty complex to be honest) I was like: “ok, that’s all for Xamarin. Let’s go native. Knowing that you have a limited budget and the deadline is far, far from here, we can do an Android version for now. Later we’ll do iOS” — they agreed and we are doing it in Kotlin. The app is beautiful, quick and there are no issues with it.
But this was supposed to be about Xamarin… sorry. Explaining myself: I won’t feel ok with myself when I don’t tell about all of the aspects of choosing the right platform. But…
Let’s say I had another client. They wrote to me something like this:
“Hi Łukasz, we are looking for a person to make an app for us. We need it in a month. Currently, we don’t have anything. We will have the designs but nothing fancy. It should be an app for people at the conference so they will know where to go, who speaks when etc. Oh, we want to support iOS and Android”.
As I was reading this email I felt like this is the perfect scenario for Xamarin. They need it ASAP, they don’t need it to be fancy, they don’t care about performance. Whatsmore would I like? Oh, they don’t have money cause they are doing it in their spare time. That’s nice. So I answered that it is possible, this is real and let’s talk about it.
No matter what I’ve written above choose Xamarin.Forms — probably you will give me a job to do 😉
Just joking: if you don’t care about money and time then you should go native. It will give you the best layout and performance results (as long as you choose good developers to get it done).
If you’d better save money and time, but still performance is important to you, then choose Xamarin.Native.
Last but not least: If you want it to be done ASAP, you want to save as much money as possible (you are starting a startup or something), performance is important to you but you can skip it if it can save you money and time — choose Xamarin.Forms.
After two posts of introduction, I think the next one will be more technical. I have some topics in a back of my head, but still, need to decide which one to choose.