Re: Swift: Trying to use ViewController(). to access object
Re: Swift: Trying to use ViewController(). to access object
- Subject: Re: Swift: Trying to use ViewController(). to access object
- From: Jens Alfke <email@hidden>
- Date: Mon, 19 Oct 2015 16:36:03 -0700
> On Oct 19, 2015, at 1:53 PM, Eric E. Dolecki <email@hidden> 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, but which works.
It sounds like the actual question is “how do I get a reference to my ViewController?” The answer depends on the context. What’s the method that needs to do this? Show us the entire method (and what class it’s in.)
Is it Cocoa programming in general that’s giving you problems, or is this something you know how to do in Objective-C but just aren’t sure in Swift?
—Jens
_______________________________________________
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