> On Mar 9, 2016, at 1:00 PM, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> What you can do instead is subclass NSWindowController, and use 
> ‘windowDidLoad’ as your opportunity to save your own strong reference to the 
> WC. (In Swift, I think I’d make it a static property of the WC class. This 
> also lets you check that nothing creates a second main window.)

I haven't been able to figure out how to do this, and I've run out of time for 
today. Any hints would sure be appreciated.

I'm doing it in my MainContentViewController class. I have declared the static 
variable mainContentViewController, with getter and setter. I have set its 
value when the view loads, in viewDidLoad(). And I use the static variable in 
AppDelegate. It compiles without error, but at runtime the setter is called 
repeatedly until it crashes -- apparently an infinite loop.

Like so:

    static var controller: MainContentViewController? {
        get {
            return  MainContentViewController.controller
        }
        set(newController) {
            MainContentViewController.controller = newController
        }
    }


-- 

Bill Cheeseman - wjcheese...@comcast.net

_______________________________________________

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