Using Xcode to develop in Cappuccino

After the creation of Objective-J, one of the first things Francisco did was write a new mode for his favorite text editor, SubEthaEdit. It was immediately obvious that we should try to make our favorite development environment as productive as possible.

A lot of people working with Cappuccino are coming from the Cocoa world, which means they’re almost universally developing in Xcode. We’ve had several requests for writing tools to integrate well with Xcode, but we just haven’t had the time. Thankfully one of our users, Raphael Bartolome, took it upon himself to build a great new Xcode plugin specifically for Cappuccino!

If you’re an Xcode user, go ahead and download the plugin now, and we’ll take a look at how it works. When you first launch the installer package, you’ll be greeted with a welcome screen. Click continue, and you’ll be presented with three options:

xcode setup step 1

You should make sure the first option is checked, so that the build tools will be installed. Be aware that this will overwrite any existing build tools installation, so if you’ve installed tools off trunk, you may want to uncheck this. The second choice will pull the latest source from GitHub for creating new projects, and the final option installs all the Xcode extras that you’ll want on your system.

Once you’ve finished installation, open Xcode, and go the new project wizard (cmd-shift-n). Choose “Web” under Mac OS X on the left hand side, and you’ll see two Cappuccino Project templates.

xcode setup step 2

The first option is an empty project that puts “Hello Cappuccino” on the screen using a CPTextField, just like NewApplication in the Cappuccino starter package. The second creates a project that includes a “CIB”, the Cappuccino Interface Bundle. CIB based applications are not yet supported, so this won’t be useful to most people just yet, but if you’ve been playing around with nib2cib, or are developing CIB technologies, you may want to use this template. Once you’ve selected your template, go ahead and finish creating the project. You’ll be greeted with a new Xcode window that looks something like this:

xcode setup step 3

You’ll find AppController.j in the Classes folder, and your other, mostly standard, files in Other Sources. Even the documentation is directly accessible in the navigation on the left, to help you look up API questions and get answers quickly. Finally, the coolest part of all — click Build & Go, and you’re Cappuccino project will automatically be bundled together and loaded in your default Browser.

Now you can edit in style with syntax coloring, (basic) code completion, and many of the other powerful features Xcode offers. Thanks again to Raphael for this exciting contribution to Cappuccino! If there’s some feature you’d like to see in the next version of the plugin, post it to the comments.

Update: I should have mentioned that it requires Xcode 3.1. The developer is working on support for earlier versions.

Tags: , ,

  • odotash
    Hi,

    I tried to add the tools to Xcode 3.2 under Snow Leopard.
    The folders in the Developers/Cappuccino stay empty.

    Is it mine bad manipulation or the Cappuccino_Developer_Tools.pkg is not compatible with those versions ?
  • boucher
    It's probably not compatible. You might want to try the newer plugin
    that's in the github repository.
  • robde
  • beefon
    Thanks!! Great!!!
  • Any way the source of the plugin could be released or open sourced so that others can add to it?
  • boucher
    Another user contributed a new xcode plugin, which is in the source
    repository. It should be a lot easier to extend, but it doesn't do
    quite as much as the old one just yet.
  • Is this Plugin being updated one day? :-)
  • bensyverson
    I'm anxious to see an update too... Currently, the skeleton apps bail with errors.
  • Glenn Rempe
    I also had problems with this (as a cappuccino newbie).

    First problem, this seems to install and entirely separate installation of Cappuccino than the one that is installed by downloading and installing as recommended on the download page. This XCode tool seems to install to /Developer/Cappuccino and the official install goes into /usr/local/share/objj and /usr/local/bin. Can you make it so that the Xcode plugin uses the same installation?

    Second problem is that you installer seems to install all of your tools under /Developer/Cappuccino as root owned and rwx permissions for ALL users. This should clearly be more restrictive.

    As mentioned by someone else, the /Developer/Cappuccino/Frameworks dir is empty by default. So even the sample project template as generated by Xcode does not work when you do build and go.

    I think its an awesome start. I look forward to the next version that hopefully clears up the remaining issues. Is there a project home page for this new tool?

    Thanks!
  • j4johnfox
    Hi Folks:

    The Xcode plugin is a glorious thing, but I'm having a bit of trouble with one thing. In my Xcode preferences, I have it set so that closing brackets are automatically added, and the tab key will indent any selected text. For some reason, these preferences don't work for Cappuccino projects.

    Here's a quick screen movie that demonstrates what I'm talking about:

    http://memoryminer.com//video/XcodeCappuccino-w...

    Is this a known issue, or is there something I can do to help fix this?

    I would very much love to use Xcode to both edit, and build (including bake).
  • Tim Henrion
    After installing this on XCode 3.1, Build and Go would not work on a created skeleton app created from New Project. I debugged this down to the /Developer/Cappuccino/Frameworks directory being empty after the install. I copied all of the folders from the Frameworks directory in the "Starter" ZIP file to this directory, re-generated the project and this seems to work.
  • Whenever I "Build and Go", only the AppController.j is packaged into the debug build. That is to say, my other classes never appear in the debug build folder. Once I copy and paste the missing classes, the app runs fine.

    I am new to Xcode and feel like I am missing something obvious...!!
  • boucher
    I've also run into this. Raphael, any suggestions?
  • Hey, I have just worked out the solution. In the Groups & Files list, you need to drag the new classes you have created (i.e not AppController.j) into the Sources folder of your app in the Targets section. I think this just tells the compiler to include the new files when it builds you app. Although, I am sure someone can explain it much better! It works though :P
  • Hi,
    yes this is the solution, normaly the xcode project copies by default the file into the right
    build phase.
    Currently you have to copy the files into the target where it has to be after the build.

    For example you create a new j source file you have to drag the file inside Source and so on.
    I work on a version that filter the files and copy it to the right target.

    -raphael
  • Very nice work here, going to enjoy this a lot.
  • Dave
    Is there something that one must do for this package to work with Xcode 3.1 for iPhone?

    http://img.skitch.com/20081002-3xnehbyh2p6a9uph...
  • No, this is am known Bug, i'm not 100% eure why the Syntax coloring sometimes not work.
    If you open the file again it works normaly.
    Try to fix it in the next version!
    Their are more open fixes for the next version.

    -raphael
  • Andrew
    I have noticed since 3.1 Xcode syntax coloring has been kind of hinky in general.
  • marius
    Thanks, Raphael ;-)
  • Thanks! :-)
blog comments powered by Disqus

Download

Cappuccino and Objective-J are licensed under the LGPL. For more information, see our licensing page.

Copyright © 2009 - 280 North, Inc. Cappuccino and Objective-J are registered Trademarks of 280 North. Logo by Sofa. Hosting by Slicehost.