Brent Simmons reacts to the news that the upcoming Photos app for Mac uses a private UXKit framework. Instead of being the full UIKit-based replacement for AppKit that many developers want, Brent suggests it could be a minimal framework just to make some things easier:
“I could imagine a minimal UXKit that isn’t meant to replace AppKit but that can be used with both AppKit and UIKit. It might have UXColor, which would wrap UIColor and NSColor. Same with UXFont and UXImage. UXTableView could present a simplified superset of UITableView and NSTableView/NSOutlineView.”
Like Brent and many other developers, I started this same kind of compatibility work when porting Tweet Library to the Mac. I ended up abandoning the project because it’s a slippery slope to basically reinventing Chameleon. (Also, back in 2006 I ported parts of Microsoft’s MFC C++ framework to Cocoa and it was a lot of work. I’m not eager to repeat that process.)
I agree with Brent that we don’t necessarily need a completely new AppKit. I’d love to see Apple standardize the foundational classes which are nearly identical already — colors, images, and fonts, as Brent mentioned — as well as UI elements that could be the same without a real cost — views, buttons, labels, table cells, and maybe split views. These UX-prefixed classes wouldn’t do everything their UI and NS versions could do, but they’d allow developers to move more code into cross-platform layers of their app by sticking to the common properties and methods.
As tempting as it would be to throw in iOS-only classes like UINavigationController, I think that would be outside the scope of a minimal UXKit. Candidates should already exist in similar forms on both platforms.
WWDC 2015 is going to be fun if Apple attempts to tackle even a little bit of this. A minimal UXKit would strike a good compromise between the usual iterative improvements to AppKit and a more revolutionary change to the frameworks.