'unowned' cannot be applied to non-class type
'unowned' cannot be applied to non-class type
- Subject: 'unowned' cannot be applied to non-class type
- From: Rick Mann <email@hidden>
- Date: Fri, 12 Feb 2016 13:37:17 -0800
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@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