> On 2015 Dec 04, at 16:32, Rick Mann <rm...@latencyzero.com> wrote:
> 
> I have an NSViewController subclass and SCNView subclass. I can get at the 
> document from the NSViewController subclass via a rather cumbersome "let doc 
> = self.view.window?.windowController?.document as? ModelDocument”

I just happened to have done that yesterday afternoon.  It seemed like the most 
logical approach to me.  “Going to the source”, even via a circuitous key path, 
is usually more robust than adding properties for convenience.

Just make sure you can guarantee that the window and view have been loaded 
previously in your situation, or you’ll get nil.  I’ve also used that as a key 
path in Cocoa Bindings.  In that case, it’s usually OK to return nil initially.
_______________________________________________

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