Tag Archives: flipbook

Minimal UXKit

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.

FlipBook

Last year I started some extra work to help bring DigiCel FlipBook to the Mac. FlipBook is software for traditional, hand-drawn animators, and it is actually somewhat unique in the industry. Whereas Flash and Toon Boom are vector-based, FlipBook started life as pencil test software for paper-based workflows. It supports scanning with peg hole auto-registration, camera capture, or drawing with a Wacom tablet.

Customers had been asking for a Mac version for a while, but the initial port from Windows to the Mac was not quite ready. It was missing QuickTime support for import, export, and video capture, and the Win32 compatibility layer was somewhat of a roadblock to a polished Mac product.

I entered the project and ended up re-architecting the application to have a more Mac-like appearance. Instead of using the Win32 library, I wrote a lightweight MFC implementation entirely in Cocoa. MFC is Microsoft’s C++ framework, still widely used even with .NET and C# pushed for new applications. This approach allowed the application to be driven almost purely from Win32 and MFC, but it uses NIBs for all windows and controls because the compatibility framework sits at a much higher level. In several places the Windows code peeks through, but it provides enough flexibility that more and more of the application could be upgraded to a modern Mac look and feel while still sharing a common Windows codebase.

The idea is that by working at the MFC level instead of Win32, you can get by with implementing only a very small subset of the full Microsoft frameworks. If the app only uses a few basic control types, for example, you only need to wrap those onto their Cocoa counterparts and can ignore everything else. (Otherwise you end up rewriting all of Win32 just to load and run the unmodified MFC sources.) Even with that simplification, though, the truth is that I seriously underestimated how much work this would be.

The stack for this ends up looking something like this:

FlipBook diagram

It has been an interesting project, both for the technical challenges and because animation is near to my heart. I plan to use the software in my own personal film projects. Here’s a screenshot of the latest version.

Time for thinking

“Gillian Carson talks about vacation time”:http://www.barenakedapp.com/misc/vacation-time on the Amigo blog:

“A holiday is a time for thinking, for relaxing your mind, for drinking beer and laughing and… for having ideas. The last time we went on holiday we came up with the idea for Carson Workshops, so I have great faith in letting your brain run free.”

I agree. Late last night I was working on a problem, something I had been struggling with in my spare time for a couple of weeks. I went back and forth between staring at an empty text editor and reading NetNewsWire. In other words, wasting time. I went out after midnight to get some milk and food for breakfast, and on the drive to the store I let my mind wander until my brain randomly struck upon an elegant solution to my coding problem. Back at my desk I implemented it in 10 lines of code and went to bed.

Have a happy July 4th everyone.