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 (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