I\'m using NSUSerDefaults to store user preferences. I remember reading somewhere that setting the keys as constants is a good idea - and I agree. The following code is what I c
Don't use const
with Objective-C objects, they weren't really designed to use it. NSString
objects (among many others) are already immutable by default by virtue of their design, so making them const
is useless.
As e.James suggested, you can use an NSString * const
, which is a constant pointer to an NSString
. This is subtly different from a const NSString *
(equivalent to NSString const *
), which is a pointer to a constant NSString
. Using a NSString * const
prevents you from reassigning kPoly
to point to a new NSString
object.