Re: NSOutlineView
Re: NSOutlineView
- Subject: Re: NSOutlineView
- From: Charles Jenkins <email@hidden>
- Date: Tue, 09 Sep 2014 07:16:20 -0400
Quincey,
Actually, if there is a space between the underscore and the name, Xcode presents a warning saying it’s extraneous. I cut and pasted the original prototypes from the documentation in order to avoid typos, and Xcode immediately displayed warning messages. Removing the space made Xcode happy.
On one hand, I treated all the methods from the prototype this same way: I pasted in the prototype from the documentation, removed the “optional” keyword, deleted the space because Xcode complained, and added my method body. All the other protocol methods are being called when they should, which I think indicates they do conform to the protocol despite the underscore.
On the other hand, I re-ran the debugger last night and never hit a breakpoint on the return statement of this particular method. Either it no longer conforms to the protocol for some reason, or (and I’ll check this tonight) Xcode is optimizing out the let and actually returning on the first line of the function body.
A breakpoint was hit on the return in a previous version, when I returned a string property, not an object. So I’m pretty sure the prototype is okay, but I have an open mind. I guess I’ll try several changes and see if things work better at each step:
Move my breakpoint up to the function declaration to see if it’s really being called
Reinsert the space after the underscore and ignore Xcode’s warnings
Delete the underscore altogether
Could it be that there’s nothing wrong with my method, but it will never get called if my binding is in the wrong place?
--
Charles
On Monday, September 8, 2014 at 19:24, Quincey Morris wrote:
> On Sep 8, 2014, at 16:00 , Charles Jenkins <email@hidden (mailto:email@hidden)> wrote:
>
> > I changed the relevant method to this:
> >
> > func outlineView(
> > _outlineView: NSOutlineView!,
> > objectValueForTableColumn tableColumn: NSTableColumn!,
> > byItem item: AnyObject!
> > ) -> AnyObject!
> > {
> > let node = getDocumentNodeFrom( item )
> > return node
> > }
>
> Well, this isn’t the prototype of the data source function. Is the above a typo, or have you misread the declaration’s “_ outlineView” parameter as “_outlineView”?
>
_______________________________________________
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