Nevermind. I forgot the "lazy".

> On Feb 12, 2016, at 13:37 , Rick Mann <rm...@latencyzero.com> wrote:
> 
> I'm having trouble getting this code to compile:
> 
> class ...
> {
>    var deleteButton : UIBarButtonItem =
>    {
>        [unowned self] in
>        let button = UIBarButtonItem(barButtonSystemItem: .Trash, target: 
> self, action: "deleteSelection:")
>        return button
>    }()
> }
> 
> I get
> 
> 'unowned' cannot be applied to non-class type 'ModelBrowserController -> () 
> -> ModelBrowserController'
> 
> and
> 
> Cannot convert value of type 'ModelBrowserController -> () -> 
> ModelBrowserController' to expected argument type 'AnyObject?'
> 
> when referencing self.
> 
> Google tells me the solution to the second error is to add [unowned self] to 
> the declaration, but then I get the other error about 'non-class type'.
> 
> Help! Thanks!
> 
> -- 
> Rick Mann
> rm...@latencyzero.com
> 
> 
> 
> _______________________________________________
> 
> 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/rmann%40latencyzero.com
> 
> This email sent to rm...@latencyzero.com


-- 
Rick Mann
rm...@latencyzero.com



_______________________________________________

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