Re: Setting NSOutlineView Delegate When a Subview
Re: Setting NSOutlineView Delegate When a Subview
- Subject: Re: Setting NSOutlineView Delegate When a Subview
- From: Thomas Wetmore <email@hidden>
- Date: Thu, 30 Jul 2015 04:30:43 -0400
Note to self: Never ask Cocoa dev questions at 4:00 am.
Sorry for wasting bandwidth. Problem was simply because I stupidly added delegate and dataSource as properties to the custom NSView. The compiler was telling me exactly what was wrong.
Tom Wetmore
> On Jul 30, 2015, at 4:22 AM, Thomas Wetmore <email@hidden> wrote:
>
> I have a custom NSView that has an NSOutlineView as a subview. Instances are created and used programatically. The code is implemented in Swift 1.2. In order to set the delegate and data source for the NSOutlineView I assumed I should just add the following methods to the custom NSView:
>
> …
> var outlineView: NSOutlineView!
> var dataSource: NSOutlineViewDataSource?
> var delegate: NSOutlineViewDelegate?
> …
> func setDelegate (delegate: NSOutlineViewDelegate?) { outlineView.setDelegate(delegate) }
> func setDataSource (dataSource: NSOutlineViewDataSource?) { outlineView.setDataSource(dataSource) }
> …
>
> However, when I do I get a similar compiler error for each method. For the setDelegate method I get:
>
> “Method ‘setDelegate’ with Objective-C selector 'setDelegate:' conflicts with setter for 'delegate' with the same Objective-C selector."
>
> I changed my method names to setOutlineViewDelegate and setOutlineViewDataSource to get around the compiler, but I don’t understand why I have to use the workaround, which feels icky to me. Can anyone provide insight? Thanks.
>
> Xcode 6.4 on Mac OS X 10.10.4.
>
> Tom Wetmore, COF
_______________________________________________
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