> On Feb 16, 2015, at 6:17 AM, Dave <d...@looktowindward.com> wrote:
> 
> My initial thought were to have a WindowController:
> LTWMainWindowController that looks after a number of Windows.

Usually you have a separate NSWindowController subclass for each distinct type 
of window. If the windows share some functionality, put it in a base class and 
subclass it. Otherwise if you try to do everything with one controller class, 
you end up with a lot of “switch(_windowType) {…}” stuff, which is a code smell 
meaning “subclass me!”

As others have pointed out, you almost never subclass NSWindow. The only reason 
to do that is if you want to do something special to the appearance or behavior 
of the window frame itself. For example, Chrome has a custom NSWindow class to 
handle drawing the tabs in the window frame.

One thing no one’s mentioned yet is NSDocument. If your app supports the 
typical behavior of opening a file into a window, you probably want to use 
NSDocument, which provides a framework for opening/saving documents, tracking 
the ‘dirty’ state, working with iCloud storage, etc.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to