Re: Segue from a toolbar item and prepareForSegue
Re: Segue from a toolbar item and prepareForSegue
- Subject: Re: Segue from a toolbar item and prepareForSegue
- From: Rick Mann <email@hidden>
- Date: Sat, 18 Oct 2014 23:33:46 -0700
I figured it out. I wasn't able to use "override" when defining my prepareForSegue(), because I renamed the sender: parameter to inSender, not realizing it needed the sender ahead of it. The example code from Apple only had sender: AnyObject?. It was very confusing, because online and in the docs, they don't show the "override" keyword being used.
Also, the background process that handles code completion keeps crashing, so my code completion was totally borked. Although, the first time it did work, it put in the override, but failed to put in the named second parameter.
Anyway, this works:
override
func
prepareForSegue(inSegue: NSStoryboardSegue, sender inSender: AnyObject?)
{
}
> On Oct 18, 2014, at 23:15 , Rick Mann <email@hidden> wrote:
>
> (NB: This is a pure-Swift app, but I don't think that matters here).
>
> OS X Storyboard app.
>
> I set up a toolbar item with a sheet segue to a view controller. Works fine, but I can't find an appropriate place to put the prepareForSegue() call. The toolbar lives in the window, so I subclassed NSWindowController, but it doesn't get the call. I tried the content view controller, but it doesn't get called, either.
>
> This severely limits what a storyboard is good for, since I can't set anything on the target, or otherwise communicate back to the caller.
>
> Am I missing something?
>
> --
> Rick Mann
> 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
--
Rick Mann
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