Over a million developers have joined DZone.

Over Two Years of Xamarin

Christian Helle talks about his two years using Xamarin and specifically his thoughts on Xamarin.

· Mobile Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

I have held radio silence for over two years because I am having a blast doing nothing but Xamarin based development. During this time I have been fully involved in building music apps that I actually use in my everyday life.

Image title

I struggled with the pains and gained a love/hate relationship with the development tools I use. I work primarily on a Mac since the products we build only target iOS and Android and I adore Xamarin Studio. It’s super fast and simple, and it reminds me of the good old bad days of Visual Studio from over a decade ago where it was pretty much just a big text editor with a few fancy features.

Xamarin Studio, of course, has its ups and downs and sometimes it just doesn’t want to cooperate. Every time a new “stable” version is out I needed to make sure that I only update during non-busy days as I risk losing all productivity if I install an update with breaking changes, or an update that is just simply broken. Some updates do break stuff!

Some breaking changes are minor and easy to fix and some are rather complex to work around the problem. I remember once our builds broke because the command line build tooling somehow got deprecated, suggesting us to move from MDTool to XBuild. Although the change sounds trivial it cost me a full day of work to update all our build scripts and double check every single build configuration to see if they worked as they should in our build servers

On top of having a full-time position doing Xamarin development for a Music Services company, I also do a few side projects. For these projects, I use Xamarin Forms as it shows a lot of promise. The early versions were terrible but they eventually got much better.

For simple UI requirements, it's absolutely perfect. With Xamarin.Forms you can create a cross-platform UI that you only write once using either a flavor of XAML or in code (using C# in my case). In Xamarin. Forms you can either take advantage of the shareable UI tooling so you only have to write the UI code once and have it rendered natively on iOS, Android, and Windows Phone, or you can create custom renderers that allow you fully control using the API’s of the platforms you target to implement the control or the entire screen. When you end up implementing the entire app using custom renderers then Xamarin. Forms starts making less sense for what you’re trying to build, but for Line-of-Business apps it's perfect. I can really see a big future in Xamarin.Forms.

Knowing and understanding the platform is always better than relying on cross-platform tools. I have mostly been working on multi-platform solutions throughout my career and the experience I gained has been a great advantage for me as I understand how a lot of things work and why API’s do what they do.

A good example of cross-platform issues is working with Bitmaps. In a nutshell, a bitmap is an array of 32-bit integers containing the Red-Blue-Green-Alpha pixel information. If you do cross-platform development and image processing you will need to ensure that the order of the pixel information bytes are uniform so that the algorithm you work with will work across all the targeted platforms. This might come as a surprise to some but pixel information is stored differently for every platform’s Bitmap API - for example, iOS uses Red-Blue-Green-Alpha, Android uses Alpha-Red-Blue-Green, and Windows uses Blue-Green-Red-Alpha. All these platforms have API’s that allow you retrieve the pixel buffer (the array of 32-bit integers) in a single call avoiding calling using slow API’s like GetPixel(x,y) hundreds or even thousands of times.

To make things even more fun the Xamarin.Forms.Color structure has a static helper method called FromUint(unit argb) but the documentation (at the time of writing) describes the method as Returns a new Color with the requested RGBA value, and the method parameter is described as A unit that represents the ARGB value of the color, and the return value is described as An RGBA color. So that was a bit confusing! Eventually, Xamarin will correct these small details or developers will just have to live with them.

I just ended a side project, and will probably not take on any new side projects for a while so I can spend more time learning new awesome stuff, or in some case understanding old awesome stuff. I have a few hobby projects that I have been intending to open source for a while so I’ll probably finish those up and finally publish them. I had some success with some open source projects such as SQL Compact Query Analyzer (50K downloads), SQL Compact Code Generator (15K downloads), and ResW File Code Generator (4K downloads), all of which had very constructive and positive reviews. I always enjoyed building developer tools and I hope to get more of that done in the near future.

The Mobile Zone is brought to you in partnership with Strongloop and IBM.  Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud.

xamarin,xamarin forms,xamarin.forms

Published at DZone with permission of Christian Helle, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}