Do I need to override the writing methods of NSDocument in subclasses for an application that will only be a viewer for files

StackOverflow https://stackoverflow.com/questions/2529300

Question

I think I may be missing the obvious but I'm not sure.

The section on subclassing NSDocument in the docs states that subclasses of NSDocument must override one reading and one writing method.

If I'm creating a viewer application that will not write anything back, do I still need to override a writing method (returning what, nil?) or can I ignore it and make sure that there are no saving methods that can get called?

Was it helpful?

Solution

Given that the documentation says “must”, I’d say yes, write a do-nothing write method. Even if it works without one now, and there’s no obvious reason to break that, if it says “must” it’s entirely fair for AppKit to actually require it at some point in future.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top