On Feb 27, 2015, at 6:28 PM, Rick Mann <rm...@latencyzero.com> wrote: > > I'm updating some older Core Data code in which I made liberal use of > transient properties to map NSNumber* types to scalar types like uint32_t. In > practice, this doesn't gain much, especially with boxing syntax, and it makes > the Core Data classes messier (shadow attributes, etc.). > > The problem is, if I change an attribute's type to NSNumber*, and fail to > modify every reference to that attribute, I often end up comparing pointers, > not values: > > @property (strong) NSNumber* someAttribute; > > if (obj.someAttribute > 42) > > which needs to become: > > if (obj.someAttribute.integerValue > 42) > > I'd love an explicit warning for misuse of NSNumber*, but a pointer-integer > comparison warning would be helpful. However, I don't see that among the > available warnings in Xcode. > > Any suggestions on how to better deal with this? Thanks!
A quick-and-dirty way to do this is to simply change the name of the property. This will cause every reference to that attribute to throw an error. Then you go fix all the errors, adding .integerValue in the process. After you’re done, you can use the refactoring tools to change the property name back. 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