Use custom getter and setter methods names but without having to create custom methods

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:

Getter:

@property(nonatomic, retain, getter=isMoving) bool moving;

Setter:

@property(nonatomic, retain, setter=newDirection) Direction *direction;

Both:

@property(nonatomic, retain, setter=currentPrice, getter=newPrice) double  price;