I have been using NSNotificationCenter to affect objects in other classes
to good effect. However, is it possible to do something like this:

*ViewController().someObject.hidden = true*

When I compile and run, I get a EXC_BAD_INSTRUCTION at that line.

*fatal error: unexpectedly found nil while unwrapping an Optional value. *

I know it exists in the ViewController scope before my line is called. I
get autocomplete in Xcode for the object too.

I can't import the ViewController in Swift. Is there a simple trick to get
this to work to avoid using NSNotificationCenter in many places? I can
still do that but the ViewController().

Thanks,
Eric
_______________________________________________

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