Xcode 4 Cocoa-Python Templates
I’ve developed a few applications using PyObjC — a bridge between Python and Apple’s Objective-C frameworks. Using Xcode 3 and some file and project templates, it was possible to use Interface Builder to create your user interface, and use Python and the PyObjC bridge to write the logic of your application.
With the release of Xcode 4, it seemed that PyObjC (or Cocoa-Python) development was not supported. Several discussions on the internet seemed to indicate that the Xcode-Interface Builder integration with Python was missing from Xcode 4, so I stayed away from Xcode 4.
With the move to Lion, avoiding Xcode 4 was no longer an option. I opened one of my PyObjC projects in Xcode 4.3, and found that Xcode/Interface Builder integration worked as I expected — I could bind UI objects to Python code as expected. So working on existing projects using Xcode 4.3 seemed to be no problem.
But starting a new PyObjC project was difficult. Xcode 3 had some project templates for creating “Cocoa-Python” applications and file templates for Python subclasses of certain NSObjects. Later versions of Xcode 3 did not include these templates, but you could download them and install them yourself. See http://ioanna.me/2009/09/installing-pyobjc-xcode-templates-in-snow-leopard/ for details.
Xcode 4 changed the format of file and project templates, and the downloadable Cocoa-Python templates for Xcode 3 do not work with Xcode 4. I looked around for updated templates, but didn’t find any online. So I decided to try to make my own…
The result is available here: https://github.com/gregneagle/Xcode4CocoaPythonTemplates
Hope these are useful to someone else!Explore posts in the same categories: OS X, Python