Skip to content

January 26, 2013

Renaming a Getter in Objective C When Using @property

by noise

If we use @property to define setters and getters for our class variables if we want our getter name to be different (by default if we do not rename it, our getter have the same name as the variable name) we will use the following syntax:

@property (strong, nonatomic, getter=showJustAString) NSString *justAString

That way our getter will be showJustAString.

Note that by default when we define the property using:

@property (strong, nonatomic) NSString *justAString

our getter will be justAString.

Read more from Objective C Noise

Leave a Reply

required
required

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments