On Mar 22, 2013, at 11:34 , Chris Tracewell <[email protected]> wrote:
> After ARC conversion it looks like....
>
> --------------------------------------------------------------------
> @interface TKObject : NSObject
> {
> NSString *__strong theString;
> }
>
> @property(readwrite,strong) NSString *theString;
> --------------------------------------------------------------------
>
> My question is, couldn't it just as easily be written the same as the pre ARC
> style sans "assign" in @property since strong is the default?
Yes, and it could just as easily be written sans "readwrite" since that's also
the default.
Note that you can likely just remove the ivar declaration completely, or at
worst move it to the @implemenation statement instead. There's really no need
to put a private ivar in a public interface file any more.
If you're going through the code cleaning things up, I'd also suggest you take
the trouble to add 'nonatomic' to your properties generally, or to add an
explicit 'atomic' in only those cases where atomicity is required and (for
custom accessors) actually implemented.
> I noticed that in most of my files that the ARC conversion tool changes it
> simply replaced properties with assign type with the strong and __strong
> designators. However three files out of about 50 it just dropped the assign
> form @property. Is there a difference or reason for this?
By chance, did those 3 files have the ivars for the properties synthesized --
not explicitly declared? There were some older compiler versions that
complained if the attributes on the property weren't the same as the attributes
on the ivar, even when they were effectively the same due to the defaults. It's
possible the conversion is being conservative for a reason like that.
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]