Compiles, but I obviously have no idea how it works yet. Yes, eventually we should factor out common parts from the iOS and MacOSX code.