A Mobile Developer's First-Hand Experience with Xamarin.iOS

05 Dec 2014

For those that don't already know, Xamarin is a fairly new and powerful platform which allows developers to create native iOS, Android, and Windows Phone apps while sharing code among them all in the C# programming language. They have also created something called Xamarin.Forms which basically provides the opportunity to share 100% of the code across all mobile platforms. For development IDE's, Xamarin allows you to code using their Xamarin Studio IDE or Microsoft's Visual Studio IDE.

I have been using the Xamarin Studio IDE for my development, and have been using Xamarin for about 6 months now fairly frequently in my daily work here at Synapse Software. At the time of writing this, 832,048 developers are using the Xamarin platform. My experience with Xamarin, particularly in building iOS apps, has been quite interesting, experiencing both pros and cons.

Designing with Xamarin

One handy thing about Xamarin.iOS is that it allows for UI design using their iOS designer (which is default when opening storyboards) or Apple's Xcode Interface Builder. Having the option to build the UI in a familiar and mature application is great. iOS designers will love having this option available to them. However, using Interface Builder with the Xamarin platform can require some new learning. Wiring up outlets and actions can be tricky to figure out the first time around.

In the future, Xamarin may improve their UI designer to be better than Interface Builder while using Xamarin.iOS. 

Programming with Xamarin

Using C# to build iOS applications has been a straightforward and smooth experience. It's something that's easier to write than Objective-C having a Java and Android background, and what helps most of all, is when building an iOS app alongside another platform, such as Android. The brain power needed to switch between platforms is much more efficiently spent when thinking about the same problem in the same language, on different platforms. It also allows for copy and pasting much of the code between both projects and maybe making only one or two tweaks rather than translating the entire block of code. If an Android app is already written and iOS is the next step, the porting of code from one platform to the other is much simpler and efficient using Xamarin. It can sometimes be difficult to identify which code can be shared and which can't or shouldn't. In some situations shared code may not be an option.

Using C# also means the entire .NET framework is available to you. Json.NET have been one handy .NET feature we at Synapse Software use with almost every project. Model objects can be defined in shared code, and Json.NET can be used to serialize and deserialize those shared objects in the same way on both platforms. We don't have to use a separate library and logic for each platform. This makes the code much more maintainable.

Overall Support of Xamarin

While using Xamarin it can sometimes become apparent that things aren't always stable. This can be one of the greater challenges of using Xamarin. Things can just get weird for seemingly no apparent reason. However, Xamarin is on top of development and release updates frequently that fix some of these strange issues. For the most part, they have very good documentation. However, there are some areas where it's lacking as with most documentation. Xamarin also has a decently sized community at forums.xamarin.com which is also a helpful place to go if you run into any questions or issues. It can also be noted that searching the general web and finding an Objective-C solution to a problem can also prove useful. It may not be as useful as finding something in C#, but it isn't as difficult as one may think to translate most Objective-C to C# for Xamarin.iOS. 

My Experience in a Nutshell

Overall, my relationship with Xamarin.iOS has been both a love and hate relationship. It can prove to be very useful and very frustrating at the same time. I believe it has served us quite well for most of the projects we have used it with, and believe that it has indeed proven itself to save time and energy in most situations. The most powerful thing about Xamarin is the code sharing ability and the consistency it provides across all platforms.

If you are using Xamarin for just one platform, it may not be living up to its potential.