• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Building an MVC based App for Mac OS X - NOT for iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building an MVC based App for Mac OS X - NOT for iOS


  • Subject: Re: Building an MVC based App for Mac OS X - NOT for iOS
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 27 May 2013 22:15:30 -0700

On May 27, 2013, at 20:34 , YT <email@hidden> wrote:

> Here is an extracted section

I found the section of documentation you're referring to (it wasn't easy, you didn't give us much to go on).

The short answer to your concern is that this piece of documentation is just plain wrong. If you need to add a view-specific controller, it should be a NSViewController, or a subclass, and not a subclass of NSController. NSController subclasses serve a different purpose -- they are "mediating" controllers, which is a respectable name for class-wrapped glue code.

If you're coming from iOS, the nearest equivalent to UIViewController is NSWindowController -- *not* NSViewController, and certainly not NSController.

When starting a new Mac app, the Cocoa classes you need to pay immediate attention to are:

-- the app delegate (a custom class you define)

-- if it's a document-based app, a NSDocument subclass

-- for each window in your app a NSWindowController subclass

In the broadest MVC terms, the "C" is often a NSWindowController subclass. The "M" is often the app delegate *or* a NSDocument subclass, or is a more specialized object graph to which the app delegate or document holds a reference. The "V" is the window and its contained views.

However, it's a bit difficult to advise you more specifically on this without knowing whether your app is document-based or non-document-based.

Stay away from NSViewController until and unless you find that you need it, and know why you need it. It isn't UIViewController. Rather, it's a sort of specialized NSWindowController, but for independently-loaded views instead of windows.



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Building an MVC based App for Mac OS X - NOT for iOS
      • From: Uli Kusterer <email@hidden>
References: 
 >Building an MVC based App for Mac OS X - NOT for iOS (From: YT <email@hidden>)
 >Re: Building an MVC based App for Mac OS X - NOT for iOS (From: Keary Suska <email@hidden>)
 >Re: Building an MVC based App for Mac OS X - NOT for iOS (From: Jens Alfke <email@hidden>)
 >Re: Building an MVC based App for Mac OS X - NOT for iOS (From: YT <email@hidden>)

  • Prev by Date: Re: Building an MVC based App for Mac OS X - NOT for iOS
  • Next by Date: NSMapTable with C strings as keys
  • Previous by thread: Re: Building an MVC based App for Mac OS X - NOT for iOS
  • Next by thread: Re: Building an MVC based App for Mac OS X - NOT for iOS
  • Index(es):
    • Date
    • Thread