We have a class WayPoint
. But at some point, we decided to rename the class to Placemark
. However, we don't really want to change the name of the class because it will result in a lot of modification of the existing code. Therefore, I added one line of typedef
at the bottom of the header file and start using Placemark
in any new code happily ever since.
@interface WayPoint : _WayPoint
@end
typedef WayPoint Placemark;
But there is still one thing that I don't understand. If I try to use the forward definition in some other header file. I can only used:
@class WayPoint;
If I use:
@class Placemark;
I will get the error message:
Redefinition of 'Placemark' as a different kind of symbol
Why?
Not sure why can't you use Xcode's refactoring features (Simple Rename does it fast and easy). But if you really want to do this you may use something better then typedef:
@compatibility_alias Placemark WayPoint
Because typedef Placemark is an alias and you are trying to use it as a class symbol.
So error clearly indicates Redefinition of 'Placemark' as a different kind of symbol which means your class name and typedef alias are different symbol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With