How Does Xamarin Work?

Jan 7, 2015 Mobile Dennis Junk

 How Does Xamarin WorkMobile technologies are opening the way to countless opportunities for businesses looking to streamline their line-of-business processes or engage with more customers. The mobile market is taking off so fast that companies aren’t just asking if they should invest in mobile apps but are instead already trying to find ways to accelerate their development cycles so they can always be coming out with new and better apps. The problem is that anyone trying to create an app that engages a variety of users has to figure out how to handle the diversity of mobile devices on the market. An app optimized for Android devices probably won’t work very well on an iPhone. So lately the name of the game has been Multi-Device Development. And one of the best players in that game today is Xamarin.

Native Performance

Each of the device platforms has its own coding language and its own Integrated Developer Environment (IDE). So, if you want to build an app that looks and functions as if it was designed specifically for iOS, you use the Objective-C language and the tools in the Xcode IDE. It’s common these days for developers to be good at more than one coding language, but even if someone has mastered all three—Objective-C, Java, and C#—it’s still going to take quite a bit of time to build an app that works natively for all three kinds of device.

Xamarin lets developers build native apps for Apple, Android, and Windows devices with a single language, C#, and a single IDE, either Visual Studio or Xamarin Studio. Whichever of these IDEs you use, you’ll have all the Software Developer Kits (SDKs) associated with not just the Windows platform (C# and Visual Studio are Windows tools) but the Android and Apple ones as well. So, instead of having to master all the languages, you can build native mobile apps for multiple device types using just one. Everything starts with C#, but Xamarin translates—or compiles—all the coding to make it work on the other device platforms.

 - Xamarin.iOS does full Ahead of Time (AOT) compilation to produce an ARM binary that’s compatible with Apple’s App Store.

 - Xamarin.Android uses Just in Time (JIT) compilation for Android devices.

Xamarin has been shipping same-day support for OS updates since iOS 5. So as soon as an update is released, you’ll be ready to perform the new compilations.

Shared Code Base

Xamarin doesn’t just give you the tools to make apps native to all device types; it also allows you to transfer a high percentage of the business logic you create for one device type to apps for the other device types. You do this using what’s called a Portable Class Library. Essentially, you build a user interface for each of the three platforms, but the rest of the coding you do for the app will work on all three.

If you build an app with Xamarin.iOS, you’ll be able to use an average of 70% of the business logic when you switch over to Xamanirn.Android. You’re still building the apps for each platform individually, but you don’t have to do anywhere near the same amount of work as you would if you had to build them from scratch each time.

Xamarin.Forms 

Xamarin.Forms lets you apply even more of the code between apps for different devices. Forms is built on XAML, which is familiar to most .NET developers, and it essentially renders native controls so each interface looks like it belongs on the platform. With Forms, more than 90% of the code you write for an app on one type of device will work on the versions for the other types of device. You may not be able to make full use of all of each device’s unique features, so in some instances you’ll still want to use Xamarin.iOS and Xamarin.Android. But for most line-of-business apps, Forms will be a great deal quicker and a great deal cheaper to work with. 

To rehash, Xamarin works by letting developers work with just the C# language to build apps for all three types of device, instead of forcing them to use three different languages. And it also allows those developers to save the vast majority of their work when they go from an app built for one platform to one built for another. The effect is a much simpler and much quicker development cycle.

Executive's Guide to Xamarin e-book

Posted in: Mobile

Topics: Mobile Custom Application Development

Comments