• 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: Safe cross references between scenes in an OS X storyboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Safe cross references between scenes in an OS X storyboard


  • Subject: Re: Safe cross references between scenes in an OS X storyboard
  • From: Bill Cheeseman <email@hidden>
  • Date: Wed, 09 Mar 2016 16:31:16 -0500

> On Mar 9, 2016, at 1:00 PM, Quincey Morris <email@hidden> 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 - email@hidden

_______________________________________________

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: Safe cross references between scenes in an OS X storyboard
      • From: Quincey Morris <email@hidden>
References: 
 >Safe cross references between scenes in an OS X storyboard (From: Bill Cheeseman <email@hidden>)
 >Re: Safe cross references between scenes in an OS X storyboard (From: Roland King <email@hidden>)
 >Re: Safe cross references between scenes in an OS X storyboard (From: Bill Cheeseman <email@hidden>)
 >Re: Safe cross references between scenes in an OS X storyboard (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Safe cross references between scenes in an OS X storyboard
  • Next by Date: Storyboard weakness
  • Previous by thread: Re: Safe cross references between scenes in an OS X storyboard
  • Next by thread: Re: Safe cross references between scenes in an OS X storyboard
  • Index(es):
    • Date
    • Thread