I’m wondering if NSDocument is only for applications that are text/document-based. I have an application that uses multiple windows, which together form a project. Would it be a good idea to implement those windows as NSDocuments?
I’m wondering if NSDocument is only for applications that are text/document-based. I have an
Share
NSDocumentmodels a document, but a document doesn’t need to be text-based. Typically, it is the in-memory representation of a file on disk. If your application works with files in a particular format (e.g. images or text or code or genomes or graphs…) thenNSDocumentwill typically be the correct class to use when modelling those files.If, however, you have windows which don’t model files,
NSDocumentis the wrong tool to use because it is geared toward file manipulation. Instead, you would typically use oneNSWindowControllerper window (or per closely-related set of windows) to control your UI.