Re: Archive/Unarchive Problem/Question?

2016-02-04 Thread Dave
> I’m wondering what would happen if I put the LTWNetwork into an Array and 
> then archived that, on unarchive, I’d get an array back and I’d just fish the 
> network out of that? I’m a bit tired at the moment and don’t want change too 
> many things at once and wondered if that would be a good idea or not?
> 

I changed the properties back to assign, and then did the above, but it still 
crashes or nil parent if weak and duped objects if strong. I thought having a 
common container class might make it work.

Really at a loss as to what to do now. I can’t think what I could be doing 
wrong that could cause this to happen?

All the Best
Dave


___

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

Re: Archive/Unarchive Problem/Question?

2016-02-04 Thread Dave
> On 4 Feb 2016, at 20:19, Jens Alfke  wrote:
> 
> 
>> On Feb 4, 2016, at 12:10 PM, Dave > > wrote:
>> 
>> I’m not sure how to get around this, is what I am doing supposed to work? I 
>> mean, should backlinks get saved/restored correctly when you 
>> archive/unarchive?
> 
> Yes, they should. What happens if you experimentally change them to strong? 
> Obviously you’ll have memory leaks, but does the object graph get unarchived 
> correctly?
> 
> —Jens

I changed them, saved a new network and restored it and now, the parent isn’t 
nil but it’s not the *same* object, it looks like is a new object each time, 
but the contents are the same? I’m not sure what this tells us?

After it’s created, the: ParentNode.child[n].parent == ParentNode.

All the Best
Dave

___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Richard Charles

> On Feb 4, 2016, at 7:59 AM, Dave  wrote:

> What could cause then Debugger to think that a regular object is an 
> Array/Dictionary?

The debugger is not perfect. You may need to use logging.

> The object in question is subclass from a custom base class.

Have you properly designed your custom base class for subclassing?

I ran into a situation about a month ago when the debugger was broken. Working 
around it was painful.

--Richard Charles


___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Clark S. Cox III



> On Feb 4, 2016, at 15:07, Jeff Evans  wrote:
> 
> Suppose one wants to do a task in an NSView only once it has no drawRect 
> calls pending. Is there any way to tell, for a particular NSView, if there 
> are any drawing events coming up? Whether, that is, the view is up to date?
> 
> I've tried counting my explicit uses of setNeedsDisplay and decrementing that 
> count at drawRect, but the trouble is that one can call setNeedsDisplay many 
> times and that will not translate into the same number of drawRects.
> 
> One idea was to call getRectsBeingDrawn at drawRect and hope that the number 
> of rects is equal to the number of update requests combined into that call. 
> But the number of rects does not appear to equal the number of draw requests.

Multiple invalid regions can be merged.

> But there must be some place that contains a queue of upcoming draw requests. 
> If so, is there access to it? 

There really isn't any such queue. There are only areas of the view that are 
marked as invalid.

> I'm hoping this is a dumb question.
> 
> Thanks, Jeff

I hate to be "that guy", but what are you actually trying to do?
___

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

auto-layout and rotated UILabels

2016-02-04 Thread Steve Christensen
Our UI design calls for a UILabel rotated 90° CCW. When I originally started 
implementing several months ago, I tried going the auto-layout route but ran 
out of time without a solution, so I went back to manual layout, calculating 
the size of the label in code then adjusting the frames of the label and 
adjacent views.

I'm now trying another shot at moving to auto-layout but am still having 
issues. There doesn't seem to be a lot of information on handling auto-layout 
and transformed views, but one thing I came across was to try embedding a 
transformed view in a non-transformed view and then applying peer and superview 
constraints to the embedding view. I did that, but it looks like the width of 
the embedding view is set to the text width of the UILabel instead of the text 
height, which is borne out by the view geometry.

(lldb) po _label
>

(lldb) print (CGRect)[_label bounds]
(CGRect) $0 = (origin = (x = 0, y = 0), size = (width = 141.5, height = 595))

(lldb) po _label.superview
>


And here's a screenshot so you can see the current state of things. I set the 
background on the embedding view to blue and the label's background to red for 
visibility.

https://www.dropbox.com/s/yb3xem9ii36rris/rotated-uilabel.jpg?dl=0


Ideally there's an all auto-layout solution but I have no clue. At this point 
I'd be happy if all I had to do was to calculate and set the rotated bounds of 
the label and then have auto-layout go from there but I'm not even sure what I 
need to do to make that happen. Does anyone have experience trying to do 
something like this? The app is running on iOS 8 and later, if that helps.

Thanks,
Steve


___

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

Re: Archive/Unarchive Problem/Question?

2016-02-04 Thread Dave
I’m wondering what would happen if I put the LTWNetwork into an Array and then 
archived that, on unarchive, I’d get an array back and I’d just fish the 
network out of that? I’m a bit tired at the moment and don’t want change too 
many things at once and wondered if that would be a good idea or not?

All the Best
Dave


___

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

How to know if an NSView has pending draws

2016-02-04 Thread Jeff Evans
Suppose one wants to do a task in an NSView only once it has no drawRect calls 
pending. Is there any way to tell, for a particular NSView, if there are any 
drawing events coming up? Whether, that is, the view is up to date?

I've tried counting my explicit uses of setNeedsDisplay and decrementing that 
count at drawRect, but the trouble is that one can call setNeedsDisplay many 
times and that will not translate into the same number of drawRects.

One idea was to call getRectsBeingDrawn at drawRect and hope that the number of 
rects is equal to the number of update requests combined into that call. But 
the number of rects does not appear to equal the number of draw requests.

But there must be some place that contains a queue of upcoming draw requests. 
If so, is there access to it? 

I'm hoping this is a dumb question.

Thanks, Jeff



___

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

Re: auto-layout and rotated UILabels

2016-02-04 Thread Quincey Morris
On Feb 4, 2016, at 13:01 , Steve Christensen  wrote:
> 
> it looks like the width of the embedding view is set to the text width of the 
> UILabel instead of the text height, which is borne out by the view geometry

Can you use a custom class for the embedding view and override its 
‘intrinsicContentSize’ property to return the inner view’s height and width 
reversed?

___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Jeff Evans
And bingo, that works perfectly. Looks like needsDisplay is exactly what I 
wanted. It's easy to check for the one view involved, but I hadn't noticed that 
property. So maybe it really was a dumb question.

Thanks, Jeff

On Feb 4, 2016, at 4:06 PM, Clark S. Cox III wrote:




> On Feb 4, 2016, at 15:52, Jeff Evans  wrote:
> 
> Clark, it's a music app; a piece is composed and placed on the screen; 
> there's a lot of massaging going on as the music adjusts visually.

Instead of looking to the view system to know when your code is done laying 
things out, why not ask your layout code directly? Or why not have your layout 
code post a notification when it begins and another when it ends?

> I want the play of the example to begin once there are no more updates 
> remaining. That is no noticeable delay in terms of human time, but makes a 
> difference in the appearance.
> 
> So I figure: the system presumably knows if it is about to send more redraw 
> requests to that view. Is there any way I could know what it knows?

If you really wanted to, I suppose you could walk the window's entire view 
hierarchy and ask every visible view for the value of its needsDisplay 
property. (Though I would advise against it

> 
> Jeff
> 
> 
> On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:
> 
> 
> 
> 
> 
> 
>> On Feb 4, 2016, at 15:07, Jeff Evans  wrote:
>> 
>> Suppose one wants to do a task in an NSView only once it has no drawRect 
>> calls pending. Is there any way to tell, for a particular NSView, if there 
>> are any drawing events coming up? Whether, that is, the view is up to date?
>> 
>> I've tried counting my explicit uses of setNeedsDisplay and decrementing 
>> that count at drawRect, but the trouble is that one can call setNeedsDisplay 
>> many times and that will not translate into the same number of drawRects.
>> 
>> One idea was to call getRectsBeingDrawn at drawRect and hope that the number 
>> of rects is equal to the number of update requests combined into that call. 
>> But the number of rects does not appear to equal the number of draw requests.
> 
> Multiple invalid regions can be merged.
> 
>> But there must be some place that contains a queue of upcoming draw 
>> requests. If so, is there access to it? 
> 
> There really isn't any such queue. There are only areas of the view that are 
> marked as invalid.
> 
>> I'm hoping this is a dumb question.
>> 
>> Thanks, Jeff
> 
> I hate to be "that guy", but what are you actually trying to do?
> 
> 
> --
> If this email is spam, report it to
> https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MDE2Njc6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ
> 
> 
> 
> ___
> 
> 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/clarkcox3%40gmail.com
> 
> This email sent to clarkc...@gmail.com




--
If this email is spam, report it to
https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MDk1MjQ6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ



___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Jeff Evans
Clark, it's a music app; a piece is composed and placed on the screen; there's 
a lot of massaging going on as the music adjusts visually. I want the play of 
the example to begin once there are no more updates remaining. That is no 
noticeable delay in terms of human time, but makes a difference in the 
appearance.

So I figure: the system presumably knows if it is about to send more redraw 
requests to that view. Is there any way I could know what it knows?

Jeff


On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:






> On Feb 4, 2016, at 15:07, Jeff Evans  wrote:
> 
> Suppose one wants to do a task in an NSView only once it has no drawRect 
> calls pending. Is there any way to tell, for a particular NSView, if there 
> are any drawing events coming up? Whether, that is, the view is up to date?
> 
> I've tried counting my explicit uses of setNeedsDisplay and decrementing that 
> count at drawRect, but the trouble is that one can call setNeedsDisplay many 
> times and that will not translate into the same number of drawRects.
> 
> One idea was to call getRectsBeingDrawn at drawRect and hope that the number 
> of rects is equal to the number of update requests combined into that call. 
> But the number of rects does not appear to equal the number of draw requests.

Multiple invalid regions can be merged.

> But there must be some place that contains a queue of upcoming draw requests. 
> If so, is there access to it? 

There really isn't any such queue. There are only areas of the view that are 
marked as invalid.

> I'm hoping this is a dumb question.
> 
> Thanks, Jeff

I hate to be "that guy", but what are you actually trying to do?


--
If this email is spam, report it to
https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MDE2Njc6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ



___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Jeff Evans
Clark, you've got a great idea there. The notification method is perhaps not 
the one, because there are circumstances in which a draw method will conclude 
that further adjustment is going to be needed and will ask for other sections 
to adjust, etc. But the view that matters here is just a single view - perhaps 
it would be enough to check needsDisplay! Worth trying.

Jeff

On Feb 4, 2016, at 4:06 PM, Clark S. Cox III wrote:




> On Feb 4, 2016, at 15:52, Jeff Evans  wrote:
> 
> Clark, it's a music app; a piece is composed and placed on the screen; 
> there's a lot of massaging going on as the music adjusts visually.

Instead of looking to the view system to know when your code is done laying 
things out, why not ask your layout code directly? Or why not have your layout 
code post a notification when it begins and another when it ends?

> I want the play of the example to begin once there are no more updates 
> remaining. That is no noticeable delay in terms of human time, but makes a 
> difference in the appearance.
> 
> So I figure: the system presumably knows if it is about to send more redraw 
> requests to that view. Is there any way I could know what it knows?

If you really wanted to, I suppose you could walk the window's entire view 
hierarchy and ask every visible view for the value of its needsDisplay 
property. (Though I would advise against it

> 
> Jeff
> 
> 
> On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:
> 
> 
> 
> 
> 
> 
>> On Feb 4, 2016, at 15:07, Jeff Evans  wrote:
>> 
>> Suppose one wants to do a task in an NSView only once it has no drawRect 
>> calls pending. Is there any way to tell, for a particular NSView, if there 
>> are any drawing events coming up? Whether, that is, the view is up to date?
>> 
>> I've tried counting my explicit uses of setNeedsDisplay and decrementing 
>> that count at drawRect, but the trouble is that one can call setNeedsDisplay 
>> many times and that will not translate into the same number of drawRects.
>> 
>> One idea was to call getRectsBeingDrawn at drawRect and hope that the number 
>> of rects is equal to the number of update requests combined into that call. 
>> But the number of rects does not appear to equal the number of draw requests.
> 
> Multiple invalid regions can be merged.
> 
>> But there must be some place that contains a queue of upcoming draw 
>> requests. If so, is there access to it? 
> 
> There really isn't any such queue. There are only areas of the view that are 
> marked as invalid.
> 
>> I'm hoping this is a dumb question.
>> 
>> Thanks, Jeff
> 
> I hate to be "that guy", but what are you actually trying to do?
> 
> 
> --
> If this email is spam, report it to
> https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MDE2Njc6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ
> 
> 
> 
> ___
> 
> 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/clarkcox3%40gmail.com
> 
> This email sent to clarkc...@gmail.com




--
If this email is spam, report it to
https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MDk1MjQ6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ



___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread dangerwillrobinsondanger
You might want to look at SpriteKit. 

Sent from my iPhone

> On Feb 5, 2016, at 11:06 AM, Jeff Evans  wrote:
> 
> Everyone, if it will be helpful I offer my solution: I just created a delayed 
> task that would begin the play of the music a fraction of a second after 
> requesting the draw of the newly loaded composition. This is pretty clean; 
> the view does all it wants to do in much less time than I'm giving it, yet to 
> the user the play seems to begin immediately after the music appears. And in 
> that time the drawing has completed any adjustments it needed.
> 
> Syncing is another matter, and that is handled separately - a timer process 
> checks for the need to scroll, to move markers, etc. Coordination is not 
> mathematically exact, but it is close enough that it would be difficult to 
> notice any discrepancy between the audio and the visual.
> 
> Jeff
> 
> On Feb 4, 2016, at 4:52 PM, Doug Hill wrote:
> 
> Jeff,
> 
> AV sync issues are definitely tricky. I would be interested in hearing 
> opinions from others on how they deal with these sync issues.
> 
> I think you’re on the right track, in that you’re trying to use messages to 
> determine when your visual state will match the audio state. As you’re 
> seeing, using the mechanics of NSView to derive these messages is problematic 
> as there are so many optimizations going on under the hood that I doubt 
> there’s a good way to get low-latency, reliable messages that you want.
> One idea that comes to mind is that view animations have completion callbacks 
> when they’re finished which might be an avenue to explore.
> 
> Anyways, hopefully there are others out there that have had to deal with 
> these AV sync issues and can give more feedback.
> 
> Doug
> 
>> On Feb 4, 2016, at 4:39 PM, Jeff Evans  wrote:
>> 
>> Doug, I had found that if the drawing mechanism was still cleaning up a few 
>> visual details - adjusting a beam or stem length after getting the context 
>> of the drawing as a whole, etc. - then it looked bad if the music began 
>> playing before that was finished. There are doubtless multiple issues here; 
>> I'm translating something from ios - but it struck me that if I just waited 
>> until no more draws were coming in that would be one way out.
>> 
>> 
>> On Feb 4, 2016, at 4:31 PM, Doug Hill wrote:
>> 
>> Jeff,
>> 
>> Are you attempting to sync the drawing with the music or are you attempting 
>> to deal with a performance issue?
>> 
>> Doug Hill
>> 
>>> On Feb 4, 2016, at 3:52 PM, Jeff Evans  wrote:
>>> 
>>> Clark, it's a music app; a piece is composed and placed on the screen; 
>>> there's a lot of massaging going on as the music adjusts visually. I want 
>>> the play of the example to begin once there are no more updates remaining. 
>>> That is no noticeable delay in terms of human time, but makes a difference 
>>> in the appearance.
>>> 
>>> So I figure: the system presumably knows if it is about to send more redraw 
>>> requests to that view. Is there any way I could know what it knows?
>>> 
>>> Jeff
>>> 
>>> 
>>> On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:
>>> 
>>> 
 On Feb 4, 2016, at 15:07, Jeff Evans  wrote:
 
 Suppose one wants to do a task in an NSView only once it has no drawRect 
 calls pending. Is there any way to tell, for a particular NSView, if there 
 are any drawing events coming up? Whether, that is, the view is up to date?
 
 I've tried counting my explicit uses of setNeedsDisplay and decrementing 
 that count at drawRect, but the trouble is that one can call 
 setNeedsDisplay many times and that will not translate into the same 
 number of drawRects.
 
 One idea was to call getRectsBeingDrawn at drawRect and hope that the 
 number of rects is equal to the number of update requests combined into 
 that call. But the number of rects does not appear to equal the number of 
 draw requests.
>>> 
>>> Multiple invalid regions can be merged.
>>> 
 But there must be some place that contains a queue of upcoming draw 
 requests. If so, is there access to it?
>>> 
>>> There really isn't any such queue. There are only areas of the view that 
>>> are marked as invalid.
>>> 
 I'm hoping this is a dumb question.
 
 Thanks, Jeff
>>> 
>>> I hate to be "that guy", but what are you actually trying to do?
> 
> 
> If this email is spam, report it to www.OnlyMyEmail.com
> 
> ___
> 
> 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/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com

___


Re: How to know if an NSView has pending draws

2016-02-04 Thread Clark S. Cox III

> On Feb 4, 2016, at 15:52, Jeff Evans  wrote:
> 
> Clark, it's a music app; a piece is composed and placed on the screen; 
> there's a lot of massaging going on as the music adjusts visually.

Instead of looking to the view system to know when your code is done laying 
things out, why not ask your layout code directly? Or why not have your layout 
code post a notification when it begins and another when it ends?

> I want the play of the example to begin once there are no more updates 
> remaining. That is no noticeable delay in terms of human time, but makes a 
> difference in the appearance.
> 
> So I figure: the system presumably knows if it is about to send more redraw 
> requests to that view. Is there any way I could know what it knows?

If you really wanted to, I suppose you could walk the window's entire view 
hierarchy and ask every visible view for the value of its needsDisplay 
property. (Though I would advise against it

> 
> Jeff
> 
> 
> On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:
> 
> 
> 
> 
> 
> 
>> On Feb 4, 2016, at 15:07, Jeff Evans  wrote:
>> 
>> Suppose one wants to do a task in an NSView only once it has no drawRect 
>> calls pending. Is there any way to tell, for a particular NSView, if there 
>> are any drawing events coming up? Whether, that is, the view is up to date?
>> 
>> I've tried counting my explicit uses of setNeedsDisplay and decrementing 
>> that count at drawRect, but the trouble is that one can call setNeedsDisplay 
>> many times and that will not translate into the same number of drawRects.
>> 
>> One idea was to call getRectsBeingDrawn at drawRect and hope that the number 
>> of rects is equal to the number of update requests combined into that call. 
>> But the number of rects does not appear to equal the number of draw requests.
> 
> Multiple invalid regions can be merged.
> 
>> But there must be some place that contains a queue of upcoming draw 
>> requests. If so, is there access to it? 
> 
> There really isn't any such queue. There are only areas of the view that are 
> marked as invalid.
> 
>> I'm hoping this is a dumb question.
>> 
>> Thanks, Jeff
> 
> I hate to be "that guy", but what are you actually trying to do?
> 
> 
> --
> If this email is spam, report it to
> https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MDE2Njc6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ
> 
> 
> 
> ___
> 
> 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/clarkcox3%40gmail.com
> 
> This email sent to clarkc...@gmail.com


___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Graham Cox

> On 5 Feb 2016, at 10:52 AM, Jeff Evans  wrote:
> 
> Clark, it's a music app; a piece is composed and placed on the screen; 
> there's a lot of massaging going on as the music adjusts visually. I want the 
> play of the example to begin once there are no more updates remaining. That 
> is no noticeable delay in terms of human time, but makes a difference in the 
> appearance.
> 
> So I figure: the system presumably knows if it is about to send more redraw 
> requests to that view. Is there any way I could know what it knows?


Personally, I think you are abusing the view here - it should obediently 
display what it’s told, not be part of your underlying logic.

However, there’s an easy-ish way to do what you want, if a little hacky.


- (void)drawRect:(NSRect) dirty
{
[NSObject cancelPreviousPerformRequestsWithTarget:self 
selector:@selector(doStuffWhenIdle) object:nil];

/* do whatever you need to draw the view */

[self performSelector:@selector(doStuffWhenIdle) withObject:nil 
afterDelay:MY_IDLE_TIME];
}


- (void) doStuffWhenIdle
{
// will be called once there are no more -drawRect calls and 
MY_IDLE_TIME has elapsed


….
}



—Graham



___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Alex Zavatone


On Feb 4, 2016, at 11:12 AM, Dave  wrote:

> Jeez, really? I need a broken debugger like a hole in the dead at the moment. 
> Any idea what causes it and how to get rid of it? Using “po” won’t help as 
> it’s a custom object, I need to look at the properties. Any ideas how I can 
> do this?

OK.  This is exactly what the autoDescribe category is meant for.

Sending it your way off line

In the debugger simply type this at a breakpoint:

po [myAwesomeObject autoDescribe]

And you’ll get something like this.

(lldb) po [indexPath autoDescribe]
2016-02-04 19:50:29.819 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] length
2016-02-04 19:50:29.819 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] row
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] section
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] item
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] ab_item
2016-02-04 19:50:29.822 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] ab_group
[NSIndexPath {length: Q = 2; 
row: q = 0; 
section: q = 2; 
item: q = 0; 
ab_item: q = 0; 
ab_group: q = 2; 
}]

Instead of something like this:

(lldb) po indexPath
 {length = 2, path = 2 - 0}


You can even use it in your log statements:

GeofenceControllerSingleton.m:1337:DLog(@"%@", [[_geofenceObjects 
objectForKey:myKey] autoDescribe]);


All in all, I find it a major lack of consideration on Apple’s end to not have 
something like this (and better written) in the Cocoa libs.  Apple and 
Objective-C tout object introspection, but Apple doesn’t hand you tools that 
let you spit out your object’s guts.  We shouldn’t have to write this stuff.  
Really.  It’s like selling a mechanic a car with no gauges.

Hope this helps.
___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Doug Hill
Jeff,

I was wondering, are you attempting to sync the drawing with the music, or is 
this a performance issue you’re seeing?

Doug Hill


> On Feb 4, 2016, at 3:52 PM, Jeff Evans  wrote:
> 
> Clark, it's a music app; a piece is composed and placed on the screen; 
> there's a lot of massaging going on as the music adjusts visually. I want the 
> play of the example to begin once there are no more updates remaining. That 
> is no noticeable delay in terms of human time, but makes a difference in the 
> appearance.
> 
> So I figure: the system presumably knows if it is about to send more redraw 
> requests to that view. Is there any way I could know what it knows?
> 
> Jeff
> 
> 
> On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:
> 
> 
>> On Feb 4, 2016, at 15:07, Jeff Evans  wrote:
>> 
>> Suppose one wants to do a task in an NSView only once it has no drawRect 
>> calls pending. Is there any way to tell, for a particular NSView, if there 
>> are any drawing events coming up? Whether, that is, the view is up to date?
>> 
>> I've tried counting my explicit uses of setNeedsDisplay and decrementing 
>> that count at drawRect, but the trouble is that one can call setNeedsDisplay 
>> many times and that will not translate into the same number of drawRects.
>> 
>> One idea was to call getRectsBeingDrawn at drawRect and hope that the number 
>> of rects is equal to the number of update requests combined into that call. 
>> But the number of rects does not appear to equal the number of draw requests.
> 
> Multiple invalid regions can be merged.
> 
>> But there must be some place that contains a queue of upcoming draw 
>> requests. If so, is there access to it? 
> 
> There really isn't any such queue. There are only areas of the view that are 
> marked as invalid.
> 
>> I'm hoping this is a dumb question.
>> 
>> Thanks, Jeff
> 
> I hate to be "that guy", but what are you actually trying to do?
> 

___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread dangerwillrobinsondanger
That's a bad idea. 
Use viewWillDraw for this approach

Sent from my iPhone

> On Feb 5, 2016, at 9:26 AM, Graham Cox  wrote:
> 
> 
>> On 5 Feb 2016, at 10:52 AM, Jeff Evans  wrote:
>> 
>> Clark, it's a music app; a piece is composed and placed on the screen; 
>> there's a lot of massaging going on as the music adjusts visually. I want 
>> the play of the example to begin once there are no more updates remaining. 
>> That is no noticeable delay in terms of human time, but makes a difference 
>> in the appearance.
>> 
>> So I figure: the system presumably knows if it is about to send more redraw 
>> requests to that view. Is there any way I could know what it knows?
> 
> 
> Personally, I think you are abusing the view here - it should obediently 
> display what it’s told, not be part of your underlying logic.
> 
> However, there’s an easy-ish way to do what you want, if a little hacky.
> 
> 
> - (void)drawRect:(NSRect) dirty
> {
>[NSObject cancelPreviousPerformRequestsWithTarget:self 
> selector:@selector(doStuffWhenIdle) object:nil];
> 
>/* do whatever you need to draw the view */
> 
>[self performSelector:@selector(doStuffWhenIdle) withObject:nil 
> afterDelay:MY_IDLE_TIME];
> }
> 
> 
> - (void) doStuffWhenIdle
> {
>// will be called once there are no more -drawRect calls and MY_IDLE_TIME 
> has elapsed
> 
> 
>….
> }
> 
> 
> 
> ―Graham
> 
> 
> 
> ___
> 
> 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/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com

___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Graham Cox

> On 5 Feb 2016, at 11:38 AM, dangerwillrobinsondan...@gmail.com wrote:
> 
> That's a bad idea. 

Agreed :)



> Use viewWillDraw for this approach


Yes, that would be better. I think even better though would be to design the 
app so that the ‘need to know when the view is done’ is not a requirement. I’ve 
written hundreds of specialist views for many different purposes, and never had 
to do this.


—Graham



___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Jeff Evans
Everyone, if it will be helpful I offer my solution: I just created a delayed 
task that would begin the play of the music a fraction of a second after 
requesting the draw of the newly loaded composition. This is pretty clean; the 
view does all it wants to do in much less time than I'm giving it, yet to the 
user the play seems to begin immediately after the music appears. And in that 
time the drawing has completed any adjustments it needed.

Syncing is another matter, and that is handled separately - a timer process 
checks for the need to scroll, to move markers, etc. Coordination is not 
mathematically exact, but it is close enough that it would be difficult to 
notice any discrepancy between the audio and the visual.

Jeff

On Feb 4, 2016, at 4:52 PM, Doug Hill wrote:

Jeff,

AV sync issues are definitely tricky. I would be interested in hearing opinions 
from others on how they deal with these sync issues.

I think you’re on the right track, in that you’re trying to use messages to 
determine when your visual state will match the audio state. As you’re seeing, 
using the mechanics of NSView to derive these messages is problematic as there 
are so many optimizations going on under the hood that I doubt there’s a good 
way to get low-latency, reliable messages that you want.
One idea that comes to mind is that view animations have completion callbacks 
when they’re finished which might be an avenue to explore.

Anyways, hopefully there are others out there that have had to deal with these 
AV sync issues and can give more feedback.

Doug

> On Feb 4, 2016, at 4:39 PM, Jeff Evans  wrote:
> 
> Doug, I had found that if the drawing mechanism was still cleaning up a few 
> visual details - adjusting a beam or stem length after getting the context of 
> the drawing as a whole, etc. - then it looked bad if the music began playing 
> before that was finished. There are doubtless multiple issues here; I'm 
> translating something from ios - but it struck me that if I just waited until 
> no more draws were coming in that would be one way out.
> 
> 
> On Feb 4, 2016, at 4:31 PM, Doug Hill wrote:
> 
> Jeff,
>  
> Are you attempting to sync the drawing with the music or are you attempting 
> to deal with a performance issue?
> 
> Doug Hill
> 
>> On Feb 4, 2016, at 3:52 PM, Jeff Evans  wrote:
>> 
>> Clark, it's a music app; a piece is composed and placed on the screen; 
>> there's a lot of massaging going on as the music adjusts visually. I want 
>> the play of the example to begin once there are no more updates remaining. 
>> That is no noticeable delay in terms of human time, but makes a difference 
>> in the appearance.
>> 
>> So I figure: the system presumably knows if it is about to send more redraw 
>> requests to that view. Is there any way I could know what it knows?
>> 
>> Jeff
>> 
>> 
>> On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:
>> 
>> 
>>> On Feb 4, 2016, at 15:07, Jeff Evans  wrote:
>>> 
>>> Suppose one wants to do a task in an NSView only once it has no drawRect 
>>> calls pending. Is there any way to tell, for a particular NSView, if there 
>>> are any drawing events coming up? Whether, that is, the view is up to date?
>>> 
>>> I've tried counting my explicit uses of setNeedsDisplay and decrementing 
>>> that count at drawRect, but the trouble is that one can call 
>>> setNeedsDisplay many times and that will not translate into the same number 
>>> of drawRects.
>>> 
>>> One idea was to call getRectsBeingDrawn at drawRect and hope that the 
>>> number of rects is equal to the number of update requests combined into 
>>> that call. But the number of rects does not appear to equal the number of 
>>> draw requests.
>> 
>> Multiple invalid regions can be merged.
>> 
>>> But there must be some place that contains a queue of upcoming draw 
>>> requests. If so, is there access to it? 
>> 
>> There really isn't any such queue. There are only areas of the view that are 
>> marked as invalid.
>> 
>>> I'm hoping this is a dumb question.
>>> 
>>> Thanks, Jeff
>> 
>> I hate to be "that guy", but what are you actually trying to do?


If this email is spam, report it to www.OnlyMyEmail.com

___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Jeff Evans
Noah, yes, thanks, I think that is it. I spoke too soon in my 
that-works-perfectly announcement, but this must be the right track to follow.
It's not clear to me when needsDisplay is being cleared in the view; I need to 
look into this a little more. So far, needsDisplay is sticking on, or appears 
to be.

Jeff

On Feb 4, 2016, at 4:19 PM, Noah Desch wrote:




The `needsDisplay` property will tell you if there are any pending draw 
requests since the last time the view was drawn, is that what you are looking 
for?

-Noah 


> On Feb 4, 2016, at 6:07 PM, Jeff Evans  wrote:
> 
> Suppose one wants to do a task in an NSView only once it has no drawRect 
> calls pending. Is there any way to tell, for a particular NSView, if there 
> are any drawing events coming up? Whether, that is, the view is up to date?
> 
> I've tried counting my explicit uses of setNeedsDisplay and decrementing that 
> count at drawRect, but the trouble is that one can call setNeedsDisplay many 
> times and that will not translate into the same number of drawRects.
> 
> One idea was to call getRectsBeingDrawn at drawRect and hope that the number 
> of rects is equal to the number of update requests combined into that call. 
> But the number of rects does not appear to equal the number of draw requests.
> 
> But there must be some place that contains a queue of upcoming draw requests. 
> If so, is there access to it? 
> 
> I'm hoping this is a dumb question.
> 
> Thanks, Jeff
> 
> 
> 
> ___
> 
> 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/deschnl%40me.com
> 
> This email sent to desc...@me.com



--
If this email is spam, report it to
https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MTIzNDg6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ



___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Alex Zavatone

On Feb 4, 2016, at 9:59 AM, Dave  wrote:

> XCode 7.2 (7C68).
> Mac OS X (not iOS).
> 
> Hi,
> 
> I sent the following message to the XCode List, but now I’m wondering if 
> there is a bug in my code that is causing this weird behaviour? What could 
> cause then Debugger to think that a regular object is an Array/Dictionary? 
> 
> The object in question is subclass from a custom base class. Apart from 
> being, NSCopying and NSCoding complaint there isn’t really anything strange 
> about it.
> 
> I’m trying to debug an App. I have a regular object that contains NSString's, 
> NSArray’s and NSDictionary’s.

First of all, they are NSStrings, NSArrays and NSDictionaries. You don’t use an 
apostrophe on a plural.  You’ll cause a fault in our brains’ English compilers.

> I have a method that does an alloc/init to get a new one, but after the init 
> call, the debugger shows the Object as LTWNodeInfo @“0 objects”  as if its an 
> array and if I try to inspect it, it won’t show be any of the properties. If 
> I print it to the log is says its the right class.
> 
> What could someone tell me why this is happening and how to fix it?
> 

Whenever the debugger appears to be barfing, I use a method I call autoDescribe 
that is a category on NSObject.

It goes through each object that you pass to it and walks into objects and 
dumps their properties, the name of the property and its value.

It’s not bulletproof and when an object contains a struct or some more 
foundation item, it might bail on you, but for all the objects that are build 
off of NSObject, it recurses through the object and spits out the items it 
finds.

If you have custom classes with properties that are NSStrings, it’s a stupid 
easy way to get a print out of the object’s internals.  

I’m not sure what the internal structure of your LTWNodeInfo is, but I’ll be 
happy to send this over if you think you’d find it useful.

There are other projects out there in the wild that appear to be called the 
same thing.  I’m not sure if they work better or worse than mine, but here’s 
one that looks useful and easy to try out.

https://github.com/neoneye/autodescribe

Good luck.

> I’m trying to get something finished for tomorrow and I can’t debug my code. 
> I’ve tried Cleaning the Build Folder, Cleaning the Project, Restarting XCode, 
> 
> Thanks in advance
> Dave
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com


___

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

Re: How to know if an NSView has pending draws

2016-02-04 Thread Doug Hill
Jeff,

AV sync issues are definitely tricky. I would be interested in hearing opinions 
from others on how they deal with these sync issues.

I think you’re on the right track, in that you’re trying to use messages to 
determine when your visual state will match the audio state. As you’re seeing, 
using the mechanics of NSView to derive these messages is problematic as there 
are so many optimizations going on under the hood that I doubt there’s a good 
way to get low-latency, reliable messages that you want.
One idea that comes to mind is that view animations have completion callbacks 
when they’re finished which might be an avenue to explore.

Anyways, hopefully there are others out there that have had to deal with these 
AV sync issues and can give more feedback.

Doug

> On Feb 4, 2016, at 4:39 PM, Jeff Evans  wrote:
> 
> Doug, I had found that if the drawing mechanism was still cleaning up a few 
> visual details - adjusting a beam or stem length after getting the context of 
> the drawing as a whole, etc. - then it looked bad if the music began playing 
> before that was finished. There are doubtless multiple issues here; I'm 
> translating something from ios - but it struck me that if I just waited until 
> no more draws were coming in that would be one way out.
> 
> 
> On Feb 4, 2016, at 4:31 PM, Doug Hill wrote:
> 
> Jeff,
>  
> Are you attempting to sync the drawing with the music or are you attempting 
> to deal with a performance issue?
> 
> Doug Hill
> 
>> On Feb 4, 2016, at 3:52 PM, Jeff Evans > > wrote:
>> 
>> Clark, it's a music app; a piece is composed and placed on the screen; 
>> there's a lot of massaging going on as the music adjusts visually. I want 
>> the play of the example to begin once there are no more updates remaining. 
>> That is no noticeable delay in terms of human time, but makes a difference 
>> in the appearance.
>> 
>> So I figure: the system presumably knows if it is about to send more redraw 
>> requests to that view. Is there any way I could know what it knows?
>> 
>> Jeff
>> 
>> 
>> On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:
>> 
>> 
>>> On Feb 4, 2016, at 15:07, Jeff Evans >> > wrote:
>>> 
>>> Suppose one wants to do a task in an NSView only once it has no drawRect 
>>> calls pending. Is there any way to tell, for a particular NSView, if there 
>>> are any drawing events coming up? Whether, that is, the view is up to date?
>>> 
>>> I've tried counting my explicit uses of setNeedsDisplay and decrementing 
>>> that count at drawRect, but the trouble is that one can call 
>>> setNeedsDisplay many times and that will not translate into the same number 
>>> of drawRects.
>>> 
>>> One idea was to call getRectsBeingDrawn at drawRect and hope that the 
>>> number of rects is equal to the number of update requests combined into 
>>> that call. But the number of rects does not appear to equal the number of 
>>> draw requests.
>> 
>> Multiple invalid regions can be merged.
>> 
>>> But there must be some place that contains a queue of upcoming draw 
>>> requests. If so, is there access to it? 
>> 
>> There really isn't any such queue. There are only areas of the view that are 
>> marked as invalid.
>> 
>>> I'm hoping this is a dumb question.
>>> 
>>> Thanks, Jeff
>> 
>> I hate to be "that guy", but what are you actually trying to do?

___

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

Re: Location of XCode of Apple Developer Site?

2016-02-04 Thread Bill Cheeseman
Dave,

You'll find Xcode 7.2.1 (February 1, 2016) here: 
.

> On Feb 4, 2016, at 10:03 AM, Dave  wrote:
> 
> Could someone please point me to where I can download XCode from the Apple 
> Developer site?

-- 

Bill Cheeseman - wjcheese...@comcast.net

___

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

Location of XCode of Apple Developer Site?

2016-02-04 Thread Dave
Hi,

Could someone please point me to where I can download XCode from the Apple 
Developer site?

I think my XCode is hosed and I’d like to re-install it - I don’t have time to 
wait for the App Store…..

Thanks a lot
Dave
___

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

Weird Problem, is this an XCode Bug?

2016-02-04 Thread Dave
XCode 7.2 (7C68).
Mac OS X (not iOS).

Hi,

I sent the following message to the XCode List, but now I’m wondering if there 
is a bug in my code that is causing this weird behaviour? What could cause then 
Debugger to think that a regular object is an Array/Dictionary? 

The object in question is subclass from a custom base class. Apart from being, 
NSCopying and NSCoding complaint there isn’t really anything strange about it.

I’m trying to debug an App. I have a regular object that contains NSString's, 
NSArray’s and NSDictionary’s. I have a method that does an alloc/init to get a 
new one, but after the init call, the debugger shows the Object as LTWNodeInfo 
@“0 objects”  as if its an array and if I try to inspect it, it won’t show be 
any of the properties. If I print it to the log is says its the right class.

What could someone tell me why this is happening and how to fix it?

I’m trying to get something finished for tomorrow and I can’t debug my code. 
I’ve tried Cleaning the Build Folder, Cleaning the Project, Restarting XCode, 

Thanks in advance
Dave


___

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

Protocol extensions returning self

2016-02-04 Thread Charles Jenkins
I’m trying to learn how to use protocols and extensions to factor out redundant 
function bodies.

Supposedly in a protocol, “Self” is the class implementing the protocol. So it 
seems to me that extension methods should be able to have a return type of Self 
so they can return self, and thus have the extension method behave the same as 
it would as if it were defined in the class adopting the protocol.

But it seems as if that’s not the case, because in the code below, when I 
return “self” from the extension’s function bodies in order to enable method 
chaining, I get a compiler error. I’m told the class is immutable. If I move 
those bodies into the separate classes adopting the protocol and change Self to 
the name of the class, then everything works as expected.

Is it possible to get the code working, or am I tilting at a windmill? I can 
imagine there’s just some minor syntax gotcha of which I’m unaware; but then 
again maybe there’s just no way to return a mutable self from a 
protocol-extension function body.

BTW, I wondered if it was a reference type vs value type thing, so I tested: it 
doesn’t matter whether I define these classes as classes or structs; the error 
message is the same.

import SpriteKit

// Create a protocol specifying the items an action collection
// must have in order for us to do fluent configuration using
// chained method calls

protocol SKActionCollection {
  var list: [SKAction] { get set } // Should be mutable!
  var action: SKAction { get }
}

// Use an extension to define methods common to both types
// of action collection

extension SKActionCollection {

  mutating func withAction( target: SKAction )
    -> Self
  {
    list.append( target )
    return self
  }

  mutating func withBlock( block: ()->() )
    -> Self
  {
    return withAction( SKAction.runBlock( block ))
  }

  mutating func withDelay( duration: NSTimeInterval )
    -> Self
  {
    return withAction( SKAction.waitForDuration( duration ))
  }

  // ... Many other useful mutating functions omitted

  func performOnceOn( node: SKNode )
  {
    node.runAction( action )
  }

}

extension SKAction {
  struct Fluent {

    // Fluent configuration for an action collection which
    // runs the actions sequentially

    class Sequence : SKActionCollection {
      var list = [SKAction]()
      var action: SKAction {
        return SKAction.sequence( list )
      }
    }

    // Fluent configuration for an action collection which
    // runs the actions concurrently

    class Group : SKActionCollection {
      var list = [SKAction]()
      var action: SKAction {
        return SKAction.group( list )
      }
    }

  }
}

// Try to use fluent configuration to define action collections

// I get the same error, saying my function call (to the constructor?)
// returns an immutable value, regardless of whether I use var or let

var sequence = SKAction.Fluent.Sequence()
  .withDelay( 0.5 )
  .withBlock( { print( "I did something in sequence!" ) } )
  .action

let group = SKAction.Fluent.Group()
  .withBlock( { print( "A group of one action is really pitiful" ) } )
  .action


-- 

Charles
___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Gary L. Wade
You're not alone. I see this every so often and just make do with the console 
view to see what I need (po is your friend). If you have more than one project 
open, you might try closing those before restarting Xcode. Another flake that 
Xcode has is putting the wrong project's source file in the Debug tab, a 
problem exacerbated by some of the projects I open from others who never 
bothered to change the names of their source files from template names; the 
worst offender is ViewController.m.

The only way to fix this is to file a bug against Xcode in 
http://bugreport.apple.com/ and wait for it to be marked as a duplicate and 
hope it gets fixed by Xcode 8.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Feb 4, 2016, at 6:59 AM, Dave  wrote:
> 
> XCode 7.2 (7C68).
> Mac OS X (not iOS).
> 
> Hi,
> 
> I sent the following message to the XCode List, but now I’m wondering if 
> there is a bug in my code that is causing this weird behaviour? What could 
> cause then Debugger to think that a regular object is an Array/Dictionary? 
> 
> The object in question is subclass from a custom base class. Apart from 
> being, NSCopying and NSCoding complaint there isn’t really anything strange 
> about it.
> 
> I’m trying to debug an App. I have a regular object that contains NSString's, 
> NSArray’s and NSDictionary’s. I have a method that does an alloc/init to get 
> a new one, but after the init call, the debugger shows the Object as 
> LTWNodeInfo @“0 objects”  as if its an array and if I try to inspect it, it 
> won’t show be any of the properties. If I print it to the log is says its the 
> right class.
> 
> What could someone tell me why this is happening and how to fix it?
> 
> I’m trying to get something finished for tomorrow and I can’t debug my code. 
> I’ve tried Cleaning the Build Folder, Cleaning the Project, Restarting XCode, 
> 
> Thanks in advance
> Dave
> 

___

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

Archive/Unarchive Problem/Question?

2016-02-04 Thread Dave
Meant to Add that pNetworkParentNode is defined as weak - does this make a 
difference? If I make it strong, it would cause a cycle? 

All the Best
Dave


___

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

Re: Archive/Unarchive Problem/Question?

2016-02-04 Thread Jens Alfke

> On Feb 4, 2016, at 11:02 AM, Dave  wrote:
> 
> However, after I unarchive this object, the pNetworkParentNode property is 
> nil. 

Is this after the entire object graph has been unarchived, or is it inside your 
-initWithCoder: method?

> I was wondering about copyWithZone, should I use copy for this?

No! That would make each node’s parent point to a copy of the parent, not the 
real parent, which would probably be disastrous.

> Meant to Add that pNetworkParentNode is defined as weak - does this make a 
> difference? If I make it strong, it would cause a cycle? 

Hm. I don’t know how weak ivars interact with unarchiving. They should work OK, 
since the unarchiver has a collection that points to every object that’s been 
unarchived and will keep any of them from getting dealloced, but I”m not sure.

But yeah, if you make that strong you’ll have cycles.

—Jens
___

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

Re: Archive/Unarchive Problem/Question?

2016-02-04 Thread Dave
Hi Jens,


> On 4 Feb 2016, at 19:21, Jens Alfke  wrote:
> 
> 
>> On Feb 4, 2016, at 11:02 AM, Dave > > wrote:
>> 
>> However, after I unarchive this object, the pNetworkParentNode property is 
>> nil. 
> 
> Is this after the entire object graph has been unarchived, or is it inside 
> your -initWithCoder: method?

After the entire Network has been unarchived. All three of the top level 
properties should be setup:

NSMutableArray*  pNetworkArray; //Contains an 
Hierarchical Array of LTWNetworkNode’s 
NSMutableDictionary* pNetworkDict   
//Contains a Hierarchical Dict of LTWNetworkNode’s
NSMutableDictionary* pNetworkFlatDict   
/Contains Flat Dictionary of Key-LongID/LTWNetworkNode’s

And in pNetworkArray the Children seem fine, but the parents are all nil. Can’t 
think how to debug this especially as I can’t look at it in the debugger. I was 
wondering if this is in fact a clue somehow?
> 
>> I was wondering about copyWithZone, should I use copy for this?
> 
> No! That would make each node’s parent point to a copy of the parent, not the 
> real parent, which would probably be disastrous.

Yes, and because it’s the same class it causes an infinite loop too!


>> Meant to Add that pNetworkParentNode is defined as weak - does this make a 
>> difference? If I make it strong, it would cause a cycle? 
> 
> Hm. I don’t know how weak ivars interact with unarchiving. They should work 
> OK, since the unarchiver has a collection that points to every object that’s 
> been unarchived and will keep any of them from getting dealloced, but I”m not 
> sure.
> 
> But yeah, if you make that strong you’ll have cycles.

Yes, how about assign? Makes me a bit nervous because if they go stale, they 
don’t get set to nil?

All the Best
Dave

___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Dave
Hi Again,

I’m trying to debug a network of interwoven objects. To do all that with “po” 
will take at least 10 times longer.

The only other way I can think to fix it, it to write a method on the Custom 
Object subclass that Logs the Properties. Doing it that would would probably 
take 3 or 4 times as long or I could write a self-test method which I suppose 
would work with the logging method(s).

I’ve tracked it down a bit more and it seems to happen with Custom Objects that 
have been unarchived. The Object that is unarchived is LTWNetwork, this 
contains an array property, the array contains instances of my custom subclass, 
its at this point that the debugger refuses to show them as custom objects and 
show @“0 objects”, immediately after the unarchive operation.

Is there something I need to do after unarchiving that resolves the new object 
as the correct class?

All the Best
Dave




___

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

Re: Easier way to make NSView subclasses refresh on a property change?

2016-02-04 Thread Motti Shneor
>> On 3 Feb 2016, at 5:05 PM, Graham Cox > > wrote:
>> 
>> Is there a good way to automate this for a given set of properties?
> 
> 
> BTW, it would be really great if this were an extension of property 
> attributes, e.g:
> 
> @property (nonatomic, assign, refresh) BOOL   goesWild;
> 
> Then the compiler’s synthesis mechanism coould just add the appropriate call 
> for views or layers as it finds. For other classes, this flags a warning.
> 
> Good idea?

Hi Graham.  

I don’t know how to extend language definitions like property attributes, and 
further, I’m not sure such attribute could be bound  to specific code that will 
call setNeedsDisplay on the instance, as language is usually unaware of the 
object types being handled. 

Yet —  your original wish can be easily granted using KVC/KVO protocol, by 
creating dependencies.

If, for example, your NSView subclass has 3 properties whose changes should 
cause the NSView to setNeedsDisplay — e.g.

@property (nonatomic) NSString *dependentPropertyA;
@property (nonatomic) BOOL   dependentPropertyB;
@property (nonatomic) CGColor   dependentPropertyC;

You can do the following in your NSView subclass implementation file.

1. Define a single property (e.g. “BOOL viewShouldRefresh) whose change drives 
the setNeedsDisplay. It will act like a “calculated property” dependent on your 
other properties.

@property (atomic, readonly) BOOL viewShouldRefresh;// atomic, to prevent 
reentrance if dependent properties change in different threads.

2. Introduce the following KVC class method, to create dependency of 
viewShouldRefresh on the other properties:

+ (NSSet *)keyPathsForValuesAffectingViewShouldRefresh {
return [NSSet setWithObjects: @“dependentPropertyA”, 
@“dependentPropertyB”, @“dependentPropertyC” ];
}

3. Implement the getter of viewShouldRefresh (not really necessary, but if you 
want to elaborate and add logic that will decide whether or not to refresh 
based on actual state of the triggering properties, you can put the logic here. 
This is the simplest: any change of any dependent property will refresh the 
view.

- (BOOL) viewShouldRefresh:(BOOL) {
return YES;
}

4. Add KVO observation for the viewShouldRefresh to your NSView subclass (say 
in the -init)

-(instancetype) init {
…
[self addObserver:self forKeyPath:@“viewShouldRefresh” 
options:NSKeyValueObservingOptionNew |  options:NSKeyValueObservingOptionOld];
}

-(void) dealloc {
[self removeObserver:self forKeyPath:@“viewShouldRefresh”];
} 

5. Finally - add the KVO generic observation method.

- (void)observeValueForKeyPath:(NSString *)keyPath of object:(id)object 
change:(NSDictionary *)change context:(void *)context {
if (obj != self || ![keyPath isEqualToString:@“viewShouldRefresh” ) 
// ignore KVO of other objects and paths.
return;

if  (self.viewShouldRefresh)// the property will calculate 
the need to refresh — in this sample - always YES.
[self setNeedsDisplay];
}


That’s it. 

From now on - adding a new dependent property will be as easy as adding its 
name to the NSSet returned by keyPathsForValuesAffectingViewShouldRefresh.

This technique applies of course to CALayers and other things - it’s just 
creating the dependency - not dictating the function.

Motti Shneor.


___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Gary L. Wade
Writing your own description or debugDescription method is a great way to view 
a large custom object, since you can format it the way you like. For an 
example, check out Apple's tech note about debugging magic (both OS X and iOS 
versions of it) and look at theirs for a view hierarchy description method.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Feb 4, 2016, at 9:05 AM, Dave  wrote:
> 
> Hi Again,
> 
> I’m trying to debug a network of interwoven objects. To do all that with “po” 
> will take at least 10 times longer.
> 
> The only other way I can think to fix it, it to write a method on the Custom 
> Object subclass that Logs the Properties. Doing it that would would probably 
> take 3 or 4 times as long or I could write a self-test method which I suppose 
> would work with the logging method(s).
> 
> I’ve tracked it down a bit more and it seems to happen with Custom Objects 
> that have been unarchived. The Object that is unarchived is LTWNetwork, this 
> contains an array property, the array contains instances of my custom 
> subclass, its at this point that the debugger refuses to show them as custom 
> objects and show @“0 objects”, immediately after the unarchive operation.
> 
> Is there something I need to do after unarchiving that resolves the new 
> object as the correct class?
> 
> All the Best
> Dave
> 

___

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

Different visualization of NSTableView row in Yosemite and El Capitan

2016-02-04 Thread Juanjo Conti
Hi there! We have a desktop app that has an NSTableView with rows and some
cells are TextFields.

In Yosemite it looks ok (the text is vertically centered):
http://snag.gy/2B1WM.jpg

Another developer built it in El Capital and text fields in the rows look
off-centered vertically: http://snag.gy/yrrn2.jpg

What can be happening? What can I try?

Thanks

-- 

Juanjo Conti http://goog_2023646312>@carouselapps.com
>

Software Engineer - Carousel Apps 

-- 
Carousel Apps Limited, registered in England & Wales with registered number 
7689440 and registered office 20-22 Wenlock Road, London, N1 7GU, United 
Kingdom. Any communication sent by or on behalf of Carousel Apps or any of 
its subsidiary, holding or affiliated companies or entities is confidential 
and may be privileged or otherwise protected. If you receive it in error 
please inform us and then delete it from your system. You should not copy 
it or disclose its contents to anyone. Messages sent to and from Carousel 
Apps may be monitored to ensure compliance with our internal policies and 
to protect our business. Emails are not secure and cannot be guaranteed to 
be error free. Anyone who communicates with us by email is taken to accept 
these risks.
___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Dave
Jeez, really? I need a broken debugger like a hole in the dead at the moment. 
Any idea what causes it and how to get rid of it? Using “po” won’t help as it’s 
a custom object, I need to look at the properties. Any ideas how I can do this?

I was wondering if it could be caused by a bug in my code that causes the 
debugger to go AWOL or something?

All the Best
Dave

> On 4 Feb 2016, at 15:56, Gary L. Wade  wrote:
> 
> You're not alone. I see this every so often and just make do with the console 
> view to see what I need (po is your friend). If you have more than one 
> project open, you might try closing those before restarting Xcode. Another 
> flake that Xcode has is putting the wrong project's source file in the Debug 
> tab, a problem exacerbated by some of the projects I open from others who 
> never bothered to change the names of their source files from template names; 
> the worst offender is ViewController.m.
> 
> The only way to fix this is to file a bug against Xcode in 
> http://bugreport.apple.com/ and wait for it to be marked as a duplicate and 
> hope it gets fixed by Xcode 8.
> --
> Gary L. Wade (Sent from my iPad)
> http://www.garywade.com/


___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Gary L. Wade
The command po is for objects and p is for intrinsics; just add a typedef on 
those. If what you mean by properties are actually instance variables, use the 
-> operator on the object.

po [anObject aPropertyThatIsAnObject]
p (BOOL )[anObject aBoolMethod]
p anObject->aBooliVar

Unless you've modified your Xcode application or its constituent tools, you're 
not to blame for this. File the duplicate bug, and work around it like everyone 
else. There are some issues with Xcode worth tracking down; this isn't one of 
those.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Feb 4, 2016, at 8:12 AM, Dave  wrote:
> 
> Jeez, really? I need a broken debugger like a hole in the dead at the moment. 
> Any idea what causes it and how to get rid of it? Using “po” won’t help as 
> it’s a custom object, I need to look at the properties. Any ideas how I can 
> do this?
> 
> I was wondering if it could be caused by a bug in my code that causes the 
> debugger to go AWOL or something?
> 
> All the Best
> Dave
> 
>> On 4 Feb 2016, at 15:56, Gary L. Wade  wrote:
>> 
>> You're not alone. I see this every so often and just make do with the 
>> console view to see what I need (po is your friend). If you have more than 
>> one project open, you might try closing those before restarting Xcode. 
>> Another flake that Xcode has is putting the wrong project's source file in 
>> the Debug tab, a problem exacerbated by some of the projects I open from 
>> others who never bothered to change the names of their source files from 
>> template names; the worst offender is ViewController.m.
>> 
>> The only way to fix this is to file a bug against Xcode in 
>> http://bugreport.apple.com/ and wait for it to be marked as a duplicate and 
>> hope it gets fixed by Xcode 8.
>> --
>> Gary L. Wade (Sent from my iPad)
>> http://www.garywade.com/
> 
> 
> ___
> 
> 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/garywade%40desisoftsystems.com
> 
> This email sent to garyw...@desisoftsystems.com

___

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

Re: [NSThread callStackSymbols] weirdness

2016-02-04 Thread Jens Alfke

> On Feb 3, 2016, at 11:28 PM, Trygve Inda  wrote:
> 
> why do I get to
> see 3 method calls in my own app in the first example, but only the last call 
> in the second example?

Tail-call optimization, probably. If the last thing a function does is call 
another function, the optimizer will change the final subroutine call plus 
return into a jump. The downside is that the first function will no longer have 
an active stack frame so it won’t show up in backtraces, unless there is a 
symbol file available.

—Jens
___

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

Re: Protocol extensions returning self

2016-02-04 Thread Jens Alfke
FYI, the swift-users list is a great place to ask questions about the Swift 
language (that don’t involve platform APIs.) Lots of expert users there, 
including Chris Lattner and other members of Apple’s Swift team.

https://lists.swift.org/mailman/listinfo/swift-users 


—Jens
___

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

Archive/Unarchive Problem/Question?

2016-02-04 Thread Dave
Hi,

I have an object LTWNetwork that contains the following properties:


NSMutableArray*  pNetworkArray; //Contains an 
Hierarchical Array of LTWNetworkNode’s 
NSMutableDictionary* pNetworkDict   
//Contains a Hierarchical Dict of LTWNetworkNode’s
NSMutableDictionary* pNetworkFlatDict   
/Contains Flat Dictionary of Key-LongID/LTWNetworkNode’s


LTWNetworkNode  has linkage (among other) properties:

LTWNetworkNode*  pNetworkParentNode //Reference to 
Parent
NSMutableArray*  pNetworkChildArray //References to 
Children
NSMutableDictionary* pNetworkChildDict  
//References to Children

The important thing to remember is that a LTWNetworkNode in the above 
collections is only present *once*, e.g. all three collections refer to the 
SAME objective-C object.

Forgetting about the pNetworkDict and pNetworkChildDict properties for the 
moment and just concentrating on the pNetworkArray, I’ve written a self-test 
method that checks this array, and, after a New Network is created it passed 
the self-test, e.g.

Parent == ChildNode[n].Parent   //Compare Object Pointers…….

However, after I unarchive this object, the pNetworkParentNode property is nil. 

Please see my other thread regarding not being able to inspect this object with 
the debugger - it shows it as an empty collection, so I can’t easily fish about 
inside the object to spot anything in the debugger. But from the self-test 
method pNetworkChildArray is setup fine, it’s just the Parent that isn’t 
working.

Looking at the class in question, here is the relevant code:

initWithCoder:
self. pNetworkParentNode= [theCoder 
decodeObjectForKey:@"pNetworkParentNode"];

encodeWithCoder
[theCoder encodeObject: self. pNetworkParentNode forKey:@"pNetworkParentNode"];

copyWithZone:
myObjectCopy. pNetworkParentNode = self. pNetworkParentNode;
//SHOULD THIS BE [self. pNetworkParentNode copy]; ?

—

I was wondering about copyWithZone, should I use copy for this? If I don’t 
would it cause this property to be restored as nil?

I’m really confused as to what is going wrong and not having a debugger isn’t 
helping, any help greatly appreciated…...

All the Best
Dave
 



___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Sandor Szatmari
I have traversed object hierarchies in the debugger using predicates and KVC in 
GDB described below. (Last tested in Xcode 4.6.3 compiler Apple LLVM 4.2)

For an array, something like... (typed in mail )
po (NSArray*)[arr filteredArrayUsingPredicate:(NSPredicate*)[NSPredicate 
predicateWithFormat:@"property == 'find me'"]]

This can be used to isolate/locate what objects are in my graph and what their 
values are.

I usually have overridden -description and can tweak that for custom debug 
information.

You can use key paths and other fun stuff to extract data while stopped in the 
debugger (valueForKey:/valueForKeyPath: using collection operators like 
@distinctUnionOfObjects...)

It is very picky about requiring you to specify return types though.

I haven't yet figured out how to do this in LLDB.  Creating the predicates on 
the fly yields a warning about forward declarations.

Sandor Szatmari

> On Feb 4, 2016, at 12:05, Dave  wrote:
> 
> Hi Again,
> 
> I’m trying to debug a network of interwoven objects. To do all that with “po” 
> will take at least 10 times longer.
> 
> The only other way I can think to fix it, it to write a method on the Custom 
> Object subclass that Logs the Properties. Doing it that would would probably 
> take 3 or 4 times as long or I could write a self-test method which I suppose 
> would work with the logging method(s).
> 
> I’ve tracked it down a bit more and it seems to happen with Custom Objects 
> that have been unarchived. The Object that is unarchived is LTWNetwork, this 
> contains an array property, the array contains instances of my custom 
> subclass, its at this point that the debugger refuses to show them as custom 
> objects and show @“0 objects”, immediately after the unarchive operation.
> 
> Is there something I need to do after unarchiving that resolves the new 
> object as the correct class?
> 
> All the Best
> Dave
> 
> 
> 
> 
> ___
> 
> 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/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari@gmail.com

___

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

Re: Different visualization of NSTableView row in Yosemite and El Capitan

2016-02-04 Thread Juanjo Conti
More info:

A version compiled in El Capitan and running on Yosemite looks ok.
A version compiled in Yosemite and running on El Capital looks off-centered.

On Thu, Feb 4, 2016 at 2:58 PM, Juanjo Conti 
wrote:

> Hi there! We have a desktop app that has an NSTableView with rows and some
> cells are TextFields.
>
> In Yosemite it looks ok (the text is vertically centered):
> http://snag.gy/2B1WM.jpg
>
> Another developer built it in El Capital and text fields in the rows look
> off-centered vertically: http://snag.gy/yrrn2.jpg
>
> What can be happening? What can I try?
>
> Thanks
>
> --
>
> Juanjo Conti http://goog_2023646312>@carouselapps.com
> >
>
> Software Engineer - Carousel Apps 
>
>


-- 

Juanjo Conti http://goog_2023646312>@carouselapps.com
>

Software Engineer - Carousel Apps 

-- 
Carousel Apps Limited, registered in England & Wales with registered number 
7689440 and registered office 20-22 Wenlock Road, London, N1 7GU, United 
Kingdom. Any communication sent by or on behalf of Carousel Apps or any of 
its subsidiary, holding or affiliated companies or entities is confidential 
and may be privileged or otherwise protected. If you receive it in error 
please inform us and then delete it from your system. You should not copy 
it or disclose its contents to anyone. Messages sent to and from Carousel 
Apps may be monitored to ensure compliance with our internal policies and 
to protect our business. Emails are not secure and cannot be guaranteed to 
be error free. Anyone who communicates with us by email is taken to accept 
these risks.
___

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Dave
There are 100’s/1000’s of nodes, would take forever, I’m writing a self-test 
method now…..

Shame about the debugger in XCode, still at least we have lots of lovely 
animations to make up for it, thanks Apple.

I’m wondering if the cause of my problems is to do with archiving/unarchiving 
as I’ve found a problem an array in an unarchived array.

Thanks for lot
All the Best
Dave

> On 4 Feb 2016, at 18:22, Sandor Szatmari  wrote:
> 
> I have traversed object hierarchies in the debugger using predicates and KVC 
> in GDB described below. (Last tested in Xcode 4.6.3 compiler Apple LLVM 4.2)
> 
> For an array, something like... (typed in mail )
> po (NSArray*)[arr filteredArrayUsingPredicate:(NSPredicate*)[NSPredicate 
> predicateWithFormat:@"property == 'find me'"]]
> 
> This can be used to isolate/locate what objects are in my graph and what 
> their values are.
> 
> I usually have overridden -description and can tweak that for custom debug 
> information.
> 
> You can use key paths and other fun stuff to extract data while stopped in 
> the debugger (valueForKey:/valueForKeyPath: using collection operators like 
> @distinctUnionOfObjects...)
> 
> It is very picky about requiring you to specify return types though.
> 
> I haven't yet figured out how to do this in LLDB.  Creating the predicates on 
> the fly yields a warning about forward declarations.
> 
> Sandor Szatmari
> 
>> On Feb 4, 2016, at 12:05, Dave > > wrote:
>> 
>> Hi Again,
>> 
>> I’m trying to debug a network of interwoven objects. To do all that with 
>> “po” will take at least 10 times longer.
>> 
>> The only other way I can think to fix it, it to write a method on the Custom 
>> Object subclass that Logs the Properties. Doing it that would would probably 
>> take 3 or 4 times as long or I could write a self-test method which I 
>> suppose would work with the logging method(s).
>> 
>> I’ve tracked it down a bit more and it seems to happen with Custom Objects 
>> that have been unarchived. The Object that is unarchived is LTWNetwork, this 
>> contains an array property, the array contains instances of my custom 
>> subclass, its at this point that the debugger refuses to show them as custom 
>> objects and show @“0 objects”, immediately after the unarchive operation.
>> 
>> Is there something I need to do after unarchiving that resolves the new 
>> object as the correct class?
>> 
>> All the Best
>> Dave
>> 
>> 
>> 
>> 
>> ___
>> 
>> 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/admin.szatmari.net%40gmail.com
>>  
>> 
>> 
>> This email sent to admin.szatmari@gmail.com 
>> 
___

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

Re: Protocol extensions returning self

2016-02-04 Thread Quincey Morris
On Feb 4, 2016, at 05:03 , Charles Jenkins  wrote:
> 
> am I tilting at a windmill? 

The problem is that the protocol in unspecific as to what kind of types it can 
be applied to, and your intentions don’t work if the type is a struct**. In 
fact, you only apply it to classes (Fluent.Sequence and Fluent.Group). So, you 
can fix the errors by saying that it’s a class-only protocol:

>   protocol SKActionCollection: class {

and eliminating the ‘mutating’ keywords.


** Because structs constructed in a expression are literals and can’t be 
mutated even if they have mutating methods. That why ‘(a + a)++’ doesn’t 
compile, even if ‘a’ is a mutable variable.

___

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

Re: Archive/Unarchive Problem/Question?

2016-02-04 Thread Dave
>> Meant to Add that pNetworkParentNode is defined as weak - does this make a 
>> difference? If I make it strong, it would cause a cycle? 
> 
> Hm. I don’t know how weak ivars interact with unarchiving. They should work 
> OK, since the unarchiver has a collection that points to every object that’s 
> been unarchived and will keep any of them from getting dealloced, but I”m not 
> sure.
> 
> But yeah, if you make that strong you’ll have cycles.

Yes, how about assign? Makes me a bit nervous because if they go stale, they 
don’t get set to nil?

I tried making the Parent Property assign and now it crashes in the self-test, 
e.g. parent is non-nill but doesn’t point to a valid object?

I’m not sure how to get around this, is what I am doing supposed to work? I 
mean, should backlinks get saved/restored correctly when you archive/unarchive? 
Do I have to do something special instead?

All the Best
Dave


___

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

Re: Archive/Unarchive Problem/Question?

2016-02-04 Thread Jens Alfke

> On Feb 4, 2016, at 12:10 PM, Dave  wrote:
> 
> I’m not sure how to get around this, is what I am doing supposed to work? I 
> mean, should backlinks get saved/restored correctly when you 
> archive/unarchive?

Yes, they should. What happens if you experimentally change them to strong? 
Obviously you’ll have memory leaks, but does the object graph get unarchived 
correctly?

—Jens

___

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