wjl
wjl

Reputation: 7351

Is UIColor's CGColor accessor a property or method?

I found a curious bit of code near the bottom of UIColor.h (lines 69-71 in my SDK):

// Access the underlying CGColor or CIColor.
@property(nonatomic,readonly) CGColorRef CGColor;
- (CGColorRef)CGColor NS_RETURNS_INNER_POINTER CF_RETURNS_NOT_RETAINED;

Why is CGColor defined as both a property and a method? Is it truly a property but just defined as a method so they use the two annotations?

Upvotes: 0

Views: 145

Answers (1)

vadian
vadian

Reputation: 285240

the method is the synthesized getter method of the property, which needs to be declared to be able to assign the return annotations

Upvotes: 1

Related Questions