ios - Add deprecation to a Core Data object or attributes -
we making big change our core data model. there couple of attributes don't want use anymore. example, following values
someobject
.
however, don't want remove values
our core data yet because using everywhere in our project.
i wondering whether possible add deprecation
tag of attributes in core data, warning whenever use them.
@interface someobject : _someobject // ... @end @interface _someobject : nsmanagedobject {} @property (nonatomic, strong) nsnumber* values; // , massive amount of auto-generated code core data @end
and saw post how flag method deprecated in objective c. , tried adding deprecation tag inside _someobject.h
such as:
@interface _someobject : nsmanagedobject {} @property (nonatomic, strong) nsnumber* values __attribute__((deprecated)); // , massive amount of auto-generated code core data @end
and works way want have 'values' deprecated
warnings on place. able focus on these warnings , fix of them before our next ship. 1 thing don't feel quite comfortable modifying auto generated code core data.
so finally, question is:
is possible add deprecation methods without touching _someobject.h
file?
not directly generate compiler warnings; manually modifying interface file correct way that. you're not introducing problems beyond potentially regenerating file , losing attribute.
a possibly preferable rounabout alternative rename properties, e.g. valuesdeprecated
. keep canonical name values
appropriate migration. write category on _someobject
deprecated property values
, implement use valuesdeprecated
storage.
then existing code should warnings , new code can avoid warnings using property word 'deprecated' in it. author need deliberately careless.
Comments
Post a Comment