I have a simple document-based Cocoa app that acts as a viewer for .wav files, to do a bit of frequency analysis. I'd like to be able to export the data gleaned from opened files to CSVs for further analysis in other programs.
The document-based application framework in Cocoa lets you override
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
to implement the default Save/Save As... workflow, but I don't want to write the files that I open.
The obvious thing to do is implement an export workflow in my document, to present a file save sheet, build some NSData, and write it to a file path, but there is not an obvious way to connect an outlet in the MainMenu nib to an action on a document controller.
So, then, what is the accepted way to implement such functionality in a document-based Cocoa app?