• 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
NSString property: copy or retain?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString property: copy or retain?


  • Subject: NSString property: copy or retain?
  • From: "Debajit Adhikary" <email@hidden>
  • Date: Mon, 22 Dec 2008 14:04:18 -0800

Let's say I have a class called SomeClass with a string property name:

@interface SomeClass : NSObject{
    NSString* name;
}

@property (nonatomic, retain) NSString* name;

@end

I understand that name may be assigned a NSMutableString in which case this
will may to errant behavior.

(1) For strings in general, is it *always* a good idea to use the "copy"
attribute instead of "retain"?
(2) Is a "copied" attribute in any way less efficient than such a
"retain-ed" attribute?
_______________________________________________

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: NSString property: copy or retain?
      • From: Ken Thomases <email@hidden>
    • Re: NSString property: copy or retain?
      • From: Ricky Sharp <email@hidden>
    • Re: NSString property: copy or retain?
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Re: NSMutableArray sorting
  • Next by Date: Replacing objects
  • Previous by thread: Re: Core DataTableView Column Sort at launch with bindings?
  • Next by thread: Re: NSString property: copy or retain?
  • Index(es):
    • Date
    • Thread