Re: Swift: Trying to use ViewController(). to access object

2015-10-19 Thread Jens Alfke
> On Oct 19, 2015, at 1:53 PM, Eric E. Dolecki wrote: > > I am asking if there is a way to call a method or set a property on an > ViewController object from another class. Sure, you just need a reference to it. > let foo = ViewController() > foo.object.hidden = true > Something like that, b

Re: Swift: Trying to use ViewController(). to access object

2015-10-19 Thread Eric E. Dolecki
By effect I meant it works as expected. Even when I set a variable to that ViewController, I get the error. I am asking if there is a way to call a method or set a property on an ViewController object from another class. let foo = ViewController() foo.object.hidden = true Something like that, but

Re: Swift: Trying to use ViewController(). to access object

2015-10-19 Thread Jens Alfke
> On Oct 19, 2015, at 11:12 AM, Eric E. Dolecki wrote: > > I have been using NSNotificationCenter to affect objects in other classes > to good effect. I don’t understand … that class is used to register notification observers and to post notifications. What do you mean by “affect”? > *ViewCo

Swift: Trying to use ViewController(). to access object

2015-10-19 Thread Eric E. Dolecki
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 un