cappuccinoobjective-j

Using Cocoa class names with Cappuccino


Is it possible to use Cocoa names for equivalent Cappuccino classes while developing for Cappuccino?

I'm thinking about trying to leverage JSCocoa, Cappuccino and Emscripten to develop either pure-Javascript or pure-Objective-C app, which would end up being compiled in the same way using native Cocoa or Cappuccino. But the first step in sharing the code would be to have Cappuccino use the same class names as Cocoa does, or vice versa.


Solution

  • You could probably create a subclass of every Cappuccino class and call it by its NS* name, then import that file of subclasses.

    However, since you are going to have to have a compilation step no matter what (to transform pointers to variables and some type declarations to var statements if nothing else) you might as well take that chance to replace NS with CP in references to anything global.