Is there a framework or other sample code for doing barcode recognition (create and scan) on cocoa [OS X]?
You have to use a third-party framework for that.
For example, you can use:
A simple Google search or StackOverflow search can help you too.