The best way for mass refactoring of properties (taking away synthezise)
I guess there is a way to do this, but I havn't found it yet.
I have a project, where all properies are synthesized
//abstract
@property (strong, nonatomic) IBOutlet UIView *containerView;
@synthesize containerView;Then containerView (the backing ivar) is used in the code.I want to change it to be this way:- no synthesize (it's redundant, as the code doesn't use custom getters and setters)- then the generated ivars of the properties are named like _containerViewBut I would prefer to call the containerView with self.containerView
Is there a clever AppCode way of doing this without too much manual work?
Thanks in advance
Please sign in to leave a comment.
Yes, you can do this. Alt-enter on _containerView usage and select "Convert to property". If you don't want to convert them one-by-one, you can convert several ivars at once - "Refactor | Convert to property". But in this case ivars have to be declared explicitly (if you convert them one-by-one, there's no such restriction).
Does it work for you?
Thanks Alexander,
the problem was, that there havn't been ivars to convert, but properties that had @synthesize and then where used without self...
I fixed it way: I erased the @synthesize, then did "replace In Path" with every property that now didn't find it's manually synthesized ivar any more, replacing myVar with self.myVar.
Still pretty fast and great :-)
Did you try what I suggested - alt+enter and "Convert to property"?
Ahhh, now I got you! It works! My mistake was to delete the @synthesize before I type Alt-Return..
Many thanks - thats what I hoped for. And I still got 30 classes to work on :-)