April 8, 2016
The Promise of UXKit & Porting iOS Apps to Mac Apps
Last year, Apple released the highly anticipated Photos app for Mac OS X. While Apple demoed it during the 2014 Worldwide Developer’s Conference (WWDC), it didn't come out until February 2015. As exciting as the release was, it was not *the* most exciting thing released that day. Shortly after the release, developers quickly discovered that the Photos app was built on an entirely new framework, UXKit.
Before digging into UXKit and its implications, lets take a step back and look at what it is currently available. In order for a developer to make an application, whether it is for a phone, tablet, or desktop, developers depend on graphical frameworks. These frameworks provide developers with a set of base user interface elements, handle basic interactions (mouse movements, touch events, etc), and lots more. Without these frameworks, making an application would take significantly more time, and every application would look and behave drastically differently. Each developer would be making his or her own user interfaces from scratch.
Long before iOS devices, Apple offered the AppKit framework for creating native Mac applications. This framework is great and works well; however, before the iPhone and iPad, there were not many developers making applications for Apple products. When the iPhone came out so did a new framework, UIKit. This was necessary as mobile applications are very different from desktop applications. Differences include mouse vs multi-touch, windows vs fullscreen apps, etc.
As the iPhone rose in popularity, developers started to take notice, and it didn’t take long for a thriving developer community for iOS to emerge. With the success of iOS brought a lot of new Mac users (the “halo effect” — iOS users switching to the Mac). With the Mac user-base growing, developers quickly attempted to begin getting their iOS applications working on the Mac. Most of these developers had never made applications for the Mac before, so they only knew UIKit. Developers hoping to quickly port all of their apps over to the Mac hit a major roadblock — AppKit. A lot of the existing code had to be re-written to support the AppKit framework, which is a time-consuming process.
When Apple released iOS 8, they made large strides in having a single codebase that supports both the iPhone and iPad with a new concept called ‘Size Classes’. As nice as this was, it did not help those iOS developers looking to port their apps to the Mac. This is where the Photos beta comes in. Developers found that the Photos Mac application is using a totally new framework called UXKit.
Upon closer inspection, UXKit runs on top of AppKit as a translation layer and UXKit appears to nearly replicate iOS’ UIKit. Having UXKit means that most iOS app developers will be able to easily and quickly bring their applications to the Mac with minimal code rewriting. Right now, UXKit exists only as a private framework, meaning developers cannot use it for their own applications. No one outside of Apple knows what the fate of UXKit is, but the developer community is already buzzing about the possibility of UXKit being available to the public. Hopefully at this year's WWDC in June Apple will release UXKit for all developers.
For those developers that want a UIKit experience on the Mac today, you should look into the UMEKit open source framework; however it is not nearly complete and only offers a small subset of UIKit capabilities - https://github.com/itod/umekit.
Author's Note: A previous version of this post appeared on the Agilex website when I was employed there. Agilex has since been acquired by Accenture Federal Services. This post has been updated to reflect dates of events and changes in the iOS landscape since it was originally published.