Re: Cocoa class extension best practice
Re: Cocoa class extension best practice
- Subject: Re: Cocoa class extension best practice
- From: Andy Lee <email@hidden>
- Date: Wed, 16 Oct 2013 13:56:00 -0400
On Oct 16, 2013, at 1:38 PM, Charles Srstka <email@hidden> wrote:
> On Oct 16, 2013, at 11:57 AM, Steve Mills <email@hidden> wrote:
>
>> So at this point, let's finish this thread by going back to my original question. Is it OK to use the private instance variable _itemArray in NSMenu since the methods we've added are *extensions* of NSMenu and not a subclass?
>
> I wouldn't. If, in some OS update, Apple changes the NSMenu class such that the _itemArray ivar is no longer being used, your app would blow up horribly. Also, if Apple starts doing something like lazily populating that array or otherwise updating it at the time you ask for it, that won't get done if you access the ivar directly.
Great points. I withdraw my "probably safe" comment. Why take a chance?
As for the creeping memory footprint, maybe try Heapshot Analysis to see what objects are being created during particular intervals?
--Andy
_______________________________________________
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