Setting NSOutlineView Delegate When a Subview
Setting NSOutlineView Delegate When a Subview
- Subject: Setting NSOutlineView Delegate When a Subview
- From: Thomas Wetmore <email@hidden>
- Date: Thu, 30 Jul 2015 04:22:54 -0400
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