It’s a sign of the times when Visual Studio Magazine covers a development tool that’s neither Visual Studio nor even made by Microsoft. Lately, they’ve been giving a lot of love to Xamarin, which lets you code with C# and the .NET Framework to create native Android, iOS, MacOS, and Windows apps, with particular attention paid to Xamarin.Forms, their new cross-platform UI API that lets you target Android, iOS, and Windows Phone with a single code base.
With Xamarin.Forms, you build mobile UIs using an API that abstracts away each mobile OS’s particular features as far as the developer is concerned. When you create a Button
in Xamarin forms, it becomes an Android Button
instance on Android devices and a UIButton
view on iOS devices. I’ve been noodling with Xamarin.Forms for the past few weeks and it looks like it’s the tool I’ll use to build sales, marketing, and training apps for partner organizations of GSG, the company I work for.
Why use Xamarin.Forms?
In their article, Simplifying Cross-Platform Mobile App Development with Xamarin.Forms, Visual Studio Magazine’s Wallace McClure suggests that you ask these questions when considering adopting Xamarin.Forms as your development platform:
- What type of expertise do you currently have? A company that has invested heavily in C# and the Microsoft .NET Framework would have a significant burden taking on Objective-C for iOS and Java for Android.
- How much do you want to invest for the application you’re developing? Web applications tend to be lower cost to get started. As customers ask for more features, the cost to continually add platform-specific features tends to cost more money than merely adding features to a platform-specific application. Will the application fit within a Web application forever, or will end users ask for features that will result in a dead-end Web interface? What happens when an application needs to use the image processing capabilities in iOS? Will the time, effort, and money spent building a Web application end up being a sunk cost?
- What’s your end-customer expectation? End customers want apps that look like all of the other apps with which they work. Giving iOS users an application that looks like some generic platform (think jQuery Mobile default themes) results in some strange looks from those users. While they won’t hate the application, they won’t love the application as much as if they’d been presented with a platform-looking application.
- Increasing the productivity of end users tends to be much more valuable than increasing the productivity of developers. End users outnumber developers by many times. I have a client with approximately 3,000 end users using an application I’ve written. A simple 5 percent increase in end-user productivity would greatly offset a 50 percent increase in developer productivity gained by using a cross-platform framework.
Xamarin.Forms in action
The article also features a sample app, which takes JSON data from a remote source via .NET’s HttpClient and displays it in list form as shown below:
It’s worth noting that they don’t show a Windows Phone screenshot — just Android and iOS. You can download the code here.
What do developers make of Xamarin.Forms?
Another Visual Studio Magazine article, Xamarin.Forms: What Developers Make of It, has McClure talking to developers who participated in the Xamarin.Forms beta program as well as Xamarin evangelist Craig Dunn. Some quotes:
- “I really like Xamarin.Forms for creating simple and complex UIs for cross-platform (mobile) apps. I’m currently working on a video catalog app for a local telco, which I’ll be building the app for iOS, Android and Windows Phone. The user will scroll through a list of categories and TV shows and pick a video to watch on the handset. The data (menu structure) comes from a JSON feed and is perfect for Xamarin.Forms. Instead of creating a separate UI for each platform I can use one code base to cover all three platforms. I’m very excited about that.”
- “One of the most useful things in XAML is the DataBinding platform and this saves a lot of time in tracking properties and changes. Now it’s in Xamarin via XF [Xamarin.Forms]. Also, you can now separate your UI code from your business/logic code and have a clearer separation of concerns.”
- “The main benefit is that if you have a .NET background or know how to write C# code or F# and want to start building mobile apps, you can start immediately with Xamarin. You won’t need to learn a new programming language, and you can reuse all of your .NET skills building mobile apps. At the same time you are saving precious time by reusing your business logic between platforms, and even your UI if you are using Xamarin.Forms. You should use Xamarin.Forms if your main goal is to develop for all three platforms and share some UI between them.”
- “The project has great traction because Xamarin.Forms is being widely adopted by many developers. We have around 10 contributors, almost 350 commits and we have NuGet packages with around 600 downloads — all this in less than two months of Xamarin.Forms being publicly available.”
Xamarin Test Cloud
Xamarin isn’t just doing their part for cross-platform coding, but cross-platform testing as well, with Xamarin Test Cloud. Xamarin Test Cloud lets you test your apps on thousands on devices with your having to acquire them all. According to the Visual Studio Magazine article Xamarin Test Cloud Now Available:
Xamarin Test Cloud can provide simulated testing environments for more than 1,000 devices, from desktops to mobile devices and includes the various OS versions on a number of platforms.
Xamarin Test Cloud can be used to automate testing of apps through its Calabash cross-platform test automation framework whether developers are working in any C# or Ruby supported tool suite, and can report back on memory and CPU usage performance and test durations. Automated testing can be integrated into Team Foundation Server and other continuous integrations systems like Jenkins and TeamCity.
Xamarin Test Cloud is able to gain access and collect diagnostics information from device logs, stack traces and through hardware data to generate performance reports for more accuracy.