How to succeed with Xamarin.Forms

Xamarin.Forms makes it possible to write UI for all the major mobile platforms, iOS, Android and Windows Phone with one shared code base. Many developers think that Xamarin.Forms isn’t is good enough to create apps that will be published and they think Xamarin.Forms is more a tool for prototyping.

If you think Xamarin.Forms is a “magic” product that will fix everything, you will properly not succeed with Xamarin.Forms. For me Xamarin.Forms is a framework that helps me build apps for multiple platforms. If you look at Xamarin.Forms in that way you will increase your chances to success with Xamarin.Forms.

Xamarin.Forms is delivered with a lot of controls that uses the Xamarin.Forms framework to render native platform specific controls. A Xamarin.Forms control is in many way just a description of what the control can do. From that description is native controls rendered.

The power of Xamarin.Forms is that you can use the framework to create you own renderers if you want to renderer a control different then the standard renderer. You can also create your own controls by using custom renderers.

I guess one of the most common issues with Xamarin.Forms i ListView performance. It’s not surprising, you maybe have 5 or 6 controls for each cell (row). If cells are reused you might have 8 cells. It means that forms need to create at least 40 renderer objects. And if any of the controls is a StackLayout or a RelativeLayout where it’s render has do to a lot of calculations where to place controls I guess you will realize that it will use a lot of memory.

So if you instead create your own custom cell that has it own renderer, there will be only one renderer for each row or if you write a renderer for the whole list you will only have one renderer. Can you realize how much memory you will save on that? If not you will see it when you are scrolling in your ListView,

The biggest problem when using Xamarin.Forms is that the developers don’t know how Xamarin.Forms works and they don’t know much about the target platforms. If you want to create a excellent app with Xamarin.Forms you still need to have knowledge about the target platforms.

Now you maybe want to ask me why you should use Xamarin.Forms? The answer is that even if you have to write platform specific code for some views there are still much you can use of the controls that is delivered with Xamarin.Forms out of the box and the powerful Xamarin.Forms framework makes it possible to write platform specific code when what you get out of the box with Xamarin.Forms not is enough.

My recommendation is to so do as much as possible with what you get out of the box with forms and don’t care about performance and if it doesn’t look perfect from the beginning. When you have created your app and built all the business logic, then you can start to look at how to make the app perfect. Than you can start write platform specific code to get better performance and a better look of the app.

11 thoughts on “How to succeed with Xamarin.Forms

  1. David says:

    Hi, Daniel. I’ve been using Xamarin.Foms on my startup and I guess we have a love-hate relationship. What I love most about XF is that we’re able to make changes really fast, we’re receiving a lot of feedback that help us to improve our app quickly and that’s priceless. Our app is getting better and better. Between updates we introduce UX improvements and bug fixing for both platform, iOS and Android.

    In the other hand… Xamarin is having a lot of problems in their Development Cycle that affects us, their customers. They’re introducing new bugs in every XF update. But the most annoying thing about XF is how the apps runs on Android. On Android the apps consume a lot of memory, the navigation is no fluid, the UI do not looks like other Android apps. Is true what you wrote about controls and stuff, but just run a XF app on iOS and Android and you will notice a huge different.

    I’m waiting for the next XF release because we’ll be able to use Material Design with AppCompat. Also we’re trying really hard to achieve a better performance. We’re expecting the best.

    Like I said before, I love XF but something I hate it 🙂

    • Rick says:

      David,

      I agree whole heartily, I am a .Net developer struggling with trying to learn Xamarin forms. While my company didn’t go for the Xamarin University subscription since very little of the content actually covered Cross – platform development, I have been trying to use tutorials, videos and any other type of learning content I can get my hands on. The problem is, I have found very little tutorials that actually work. It seems that in everyone of them, I get to a certain point where a library cant be referenced or something has changed and I cannot continue. It is i enough to make one say to hell with Xamarin. Are there any type of decent up to date training references that you might be able to recommend?

      Very Frustrated…..

  2. thanks for sharing Daniel. As I said I love Xamarin and I like Forms but it needs real examples of apps with a “good” UI sweet perfomance. I didnt find one yet, I have found demos, examples or so small apps but not a typical enterprise app.

    • Hi!

      It could be as simple as people just don’t say that they are using Xamarin Forms for their apps. Done right, you can’t tell any difference from an app developed with the traditional approach. (I refrain from using the term Native since all the apps are native anyhow 🙂 )

      Sorry for crashing the thread! 😉

      // Johan

  3. someguy says:

    Worked with Xamarin Forms on some enterprise projects. Xamarin Forms is pretty bad for an app with more than 3 screens. A lot of magical bugs, a lot of performance problems(Why should I care how many renderers it creates, I would just write natively instead).

    You can optimize a lot of stuff in Xamarin Forms, but why should I do this if I can just write natively instead in the same amount of time?

    My verdict: it is good only for prototyping, not for actual product.

Leave a Reply

Your email address will not be published. Required fields are marked *