When I tried the first beta release of Project Mono for iOS, the precursor of what would become Xamarin Studio, I (and many other iOS developers) was intrigued by what I saw. I have never been a big fan of Objective-C, feeling like it was a vestigial language from another time and place. But Objective-C has matured considerably, even though it still lacks the comfort and syntactical ease of more modern languages like Java or C#. So when Xamarin offered the ability to build native iOS applications using C#, a language far more popular in the large than Objective-C, I was cautiously enthusiastic. That first experience proved that C# code could be compiled into native iOS programs, but it was a disjointed experience. Much of the presentation layer was reliant on knowing how to use Apple's developer tools such as Xcode and Interface Builder.
A lot has changed since that first release. Version 3.0 provides many new important features, which I'll describe in a moment. In this discussion, I'll refer occasionally to my previous review of Xamarin 2 release.
What's New in Version 3?
Xamarin touts that this new release includes more than 150 new features and thousands of enhancements. While that may be the case, the new additions that will matter the most to existing and new Xamarin developers alike are the Xamarin Designer for iOS, Xamarin.Forms, the new UI for Xamarin Studio, and integration improvements between Xamarin and Microsoft Visual Studio. Let's take a closer look at each of these major enhancements.
Xamarin Designer for iOS
The Xamarin Designer for iOS is the best, most groundbreaking improvement in the new feature line-up. It finally brings an integrated iOS GUI editor to both Mac OSX and Microsoft Windows platforms. And just as Visual Studio developers have come to expect the live preview of controls in the forms assembly environment, Xamarin Designer supports that feature as well. That's a huge deal for previous Xamarin developers who preferred using the far richer Visual Studio development environment versus Xamarin's OSX-based Studio. Instead of having to bounce back and forth between Xcode on the Mac and Visual Studio on Windows, VS users can now work almost entirely within a Windows environment.
Figure 1: Designing iOS user interfaces inside Microsoft Visual Studio. How cool is that?
However, Visual Studio developers are still beholden to the Apple software tools because Xamarin has no other choice but to rely on Apple's Xcode tools running on a Mac computer to compile and digitally sign an iOS binary for deployment. Fortunately, Xamarin has made this process as painless as possible by providing the Xamarin.iOS Build Host that runs on a Mac with Xcode installed. This has been available since the Xamarin 2 release, but now that both screen designing and code writing can take place within the same development environment, productivity soars as a result.
Figure 2: Xamarin.iOS Build Host allows Visual Studio developers to create iOS apps almost entirely within the Visual Studio IDE.
Xamarin Designer also fully supports the latest design elements in iOS 6 (and later) including Apple's latest Storyboard format. Storyboard usurps Interface Builder and turns app screens into a flowing set of forms. Xamarin Designer also supports auto-layout and has intuitive event handling so everything works as you would expect. Developers can even extend their own controls to support live, design-time rendering previews. This capability will no doubt fuel even more growth in Xamarin's component marketplace.
Figure 3: Xamarin Designer for iOS supports Apple's Storyboard format.
I was quickly up and running with the designer within both Xamarin Studio on the Mac and Visual Studio on Windows, assembling live-preview UIs and running the results in the iPhone and iPad simulators within a matter of minutes. It really is a game changer, and one that has been a long time coming.
As long-time fans of Xamarin know, the desire to write a native app for the Android and iOS platforms from a single project codebase using Xamarin Studio has been confounded by the drastic differences in the way each of these platforms employ their own native UI components. Previously, developers using Xamarin tools to target both platforms would have to be forward-thinking in breaking out their code into reusable layers that could be shared between platform compilations. But with the new Xamarin.Forms, developers can finally use the same UI design and code for either target platform, and compile projects to automatically use the native controls on both.
In other words, the dream of developing a single project containing both presentation and logic layers that can be compiled and executed on multiple mobile OS targets using Xamarin's platform is finally a reality. Combined with Xamarin Designer, employing Xamarin.Forms and its default set of 43 controls and layouts will swap Xamarin's UI representations with the target mobile platform's own buttons, sliders, switches, etc. Thanks to Xamarin.Forms, the days of lowest-common-denominator mobile UIs are over.
Figure 4: Xamarin.Forms delivers native user interfaces on mobile platforms from a single design code base.
Of course, there will always be a need to leverage platform-specific widgets to polish cross-platform targeted apps. Fortunately, Xamarin allows Xamarin.Forms to be mixed in with native, targeted components so their approach does not require an all-or-nothing decision. Forms are also extensible, and a well-documented API gives developers a great degree of flexibility for customization and control. After quickly acclimating to this new level of platform UI abstraction, I felt a majority of business-class and many consumer-level scenarios could be competently rendered with Xamarin.Forms assistance. And with no loss in user experience fidelity, Xamarin.Forms will no doubt become the most popular way to develop UI-rich Xamarin apps in the future.
Windows .NET developers will also appreciate Xamarin.Forms support for XAML, especially because Xamarin.Forms works across all three mobile platforms (Android 4+, iOS 6.1+, and Windows Phone 8+).
While it might never be possible to create a highly complex, cross-platform native mobile application from a single code source, Xamarin.Forms is a huge leap forward in making developers' design workflows far easier to manage.