> On Jun 2, 2015, at 3:31 PM, Jens Alfke <j...@mooseyard.com> wrote:
> 
>> Anyway, yes, one could ugly up one’s code with italics and boldface and 
>> whatnot, but simply prefixing the ivar name with an underscore is simpler, 
>> it prevents accidentally referencing the ivar and/or shadowing it with a 
>> local variable, and it’s what Apple recommends. Better all around, if you 
>> ask me.
> 
> I agree, actually. But in Swift the concept of ivar no longer exists, so I 
> have to rely on color/style to distinguish properties from locals.

My solution with Swift is to consistently use the “self.” prefix when 
referencing properties. If Apple could include an optional compiler warning to 
enforce this like they do with Obj-C auto-synthesis, it’d be *great* (hint hint 
for any Apple engineers that happen to be reading this).

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

Reply via email to