Home > Software engineering >  Is NSDocument subclass a model object or not?
Is NSDocument subclass a model object or not?

Time:12-03

I am writing a multi-document application for macOS Swift. I'm starting with the Document app template provided by Xcode. It's unclear whether it’s an object model or not. Is NSDocument the model or is the data contained therein the model?

CodePudding user response:

Apple enter image description here

This NSDocument subclass imports Cocoa and is deeply entangled with UI layer code, so one would be hard-pressed to call a true model object (though it is a useful abstraction). Many of us strive to keep true “model” objects free of UI/OS dependencies.

In short, the data managed by the NSDocument is more aptly considered the “model”.

  • Related