Unified API with 64-bit Support for iOS and Mac
Today we are pleased to share some major improvements to the APIs for our iOS and Mac products.
Why a new API?
The Classic Xamarin.iOS and Xamarin.Mac APIs had two major flaws:
- They did not support 64 bit applications.
- They made iOS and Mac code sharing cumbersome.
As Mac OS X evolved, more and more frameworks became available only as 64 bit frameworks. Additionally, iOS recently made the 64-bit jump when the iPhone 5s was launched.
Last year we started a redesign for our 64-bit support, one that would meet the following goals:
- The same source code must work on both 32 and 64-bit platforms
- Libraries and binaries would run either in 32 or 64 bit modes, depending on the host platform and build settings, with no source code changes or recompilation required
- Improved code sharing story between our Mac and iOS products.
Enter The Unified API
The result of more than a year of development on our API bindings and Mono’s runtime is our Unified API, which we are introducing today as a preview feature. The Unified API accomplishes everything we set out to and so much more.
First, we addressed the 32/64 bit split, by surfacing an API that is 32/64 bit agnostic.
Second, we dropped the namespace prefixes. This makes sharing code between iOS and Mac apps less tedious to maintain and easier on the eyes. An example to demonstrate this is what you had to do before when you had to use a using:
#if MAC MonoMac.Foundation; #elif IOS MonoTouch.Foundation; #endif
With the Unified API you can simply use:
This means with the new Unified API we have not only made it easier to share common code across your iOS and Mac applications, but you are now able to take advantage of all of the new 64-bit APIs on each platform.
Get Started & Backwards Compatibility
The new Unified API is available now in the Beta channel. We made the new Unified API opt-in, which means there is no need to upgrade to this new API unless you want to take advantage of the features outlined above. Xamarin will continue to support the Classic API you are familiar with for both Mac and iOS alongside the Unified API indefinitely.
We are currently working on both templates to get you started (or you can migrate on your own), as well as a migration assistant that will do the bulk of the port for you.
What is Missing?
We are aware that the following features are currently missing and we are working on them:
- Binding Project Types, to easily call into native libraries
- Complete templates for all the scenarios previously supported
- Xamarin’s Components are not available yet
Register for Our Webinar
We’ll be hosting a webinar to help you, “Get Ready for iOS 8,” on Thursday, September 11 at 8 am PDT. Join us then for a walkthrough of the top new and updated APIs in the iOS 8 release. Xamarin developers will be able to take advantage of the new APIs within hours of Apple’s public release, so attend this webinar to help get your apps iOS 8-ready.