This is the code example that goes with my blog post Exporting SVG From Cocoa
Built in xcode 4.6.3 with 10.8 sdk. It should compile in earlier versions without too much trouble.
The data objects are sort of simplified versions from SQLEditor, but don't do much except sit around waiting to be drawn.
License is BSD 3 clause, see license.txt file.
Hope it proves useful. :-)