When editing legacy code you sometimes come across the scenario where a getter and setter method has been created that performs the same job as a property would but a property wasn’t used. So you decide to tidy it and create a property for that instance variable. However the getter and setter don’t conform to the naming convention that Apple uses for properties, that where the getter and setter attribute for properties comes in handle. These attributes let you create a custom name for the getter and setter while keeping the inbuilt functionality.
Below is the code:
@property(nonatomic, retain, getter=isMoving) bool moving;
@property(nonatomic, retain, setter=newDirection) Direction *direction;
@property(nonatomic, retain, setter=currentPrice, getter=newPrice) double price;