Nevermind. I forgot the "lazy".

> On Feb 12, 2016, at 13:37 , Rick Mann <[email protected]> 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
> [email protected]
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> 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 [email protected]


-- 
Rick Mann
[email protected]



_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to