• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: RS: NSObject members class and isMemberOfClass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RS: NSObject members class and isMemberOfClass


  • Subject: Re: RS: NSObject members class and isMemberOfClass
  • From: "Finlay Dobbie" <email@hidden>
  • Date: Fri, 7 Sep 2007 14:15:42 +0100

On 07/09/2007, Mike Abdullah <email@hidden> wrote:
> OK, well as it says in the docs, NSArray and NSMutableArray are
> actually what is known as a class cluster. They are privately
> subclassed by Cocoa in various ways. e.g. NSCFArray.
>
> However, this shouldn't matter to you, it is an implementation
> detail. So the question that really matters is why you seem to need
> to know this? If you ask Cocoa to create a mutable array, it will,
> and you don't need to know or care about the actual class.

Well, it is slightly semantically broken - you ask for an NSArray and
you get an immutable instance of something which claims to be a
subclass of NSMutableArray back.

There isn't any supported way of determining if an array is mutable or
not. You probably could do it using undocumented private
CoreFoundation functions, but you shouldn't really need to. If you
have an array and you need to modify it, and you're not sure if it's
mutable or not, make a mutable copy. You might want to do this anyway,
since the person that handed you the array might not want it to be
modified underneath them. Or if they do, say that you require a
mutable array, and assume that it will be mutable.

 -- Finlay
_______________________________________________

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

  • Follow-Ups:
    • Re: RS: NSObject members class and isMemberOfClass
      • From: Nick Zitzmann <email@hidden>
    • Re: RS: NSObject members class and isMemberOfClass
      • From: Chris Suter <email@hidden>
References: 
 >RS: NSObject members class and isMemberOfClass (From: Roland Silver <email@hidden>)
 >Re: RS: NSObject members class and isMemberOfClass (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: RS: NSObject members class and isMemberOfClass
  • Next by Date: Re: Multiple One-to-One Core Data relationships & inverse
  • Previous by thread: Re: RS: NSObject members class and isMemberOfClass
  • Next by thread: Re: RS: NSObject members class and isMemberOfClass
  • Index(es):
    • Date
    • Thread