Q:

Accessing Property Values of a Protocol?

Hey guys, I have a protocol which defines a number of ObjC-2.0 properties, like so:
@protocol Repeatable <NSCoding>
@required
@property (nonatomic, retain) Date *startDate;
@property (nonatomic, retain) Date *endDate;
@end

I have another class that implements the protocol:
@interface AbstractRepeatable : NSObject <Repeatable>

And finally, in AbstractRepeatable, I am implementing a method defined by the protocol:
- (BOOL)isEqualToRepeatable:(Repeatable *)r {
    if (r.startDate != startDate) // Compiler error here
        return NO;
    return YES;
}

Bits and pieces have been excluded for example-sake, but when compiling, I receive the familiar "request for member 'startDate' in something not a structure or union" on the line noted above. The AbstractRepeatable obviously includes the Repeatable header, otherwise the protocol would not be visible, so I don't know which part I'm missing.

A:

In your isEqualToRepeatable: method you are treating Repeatable as a class, not a protocol.  Try using the following.  Everything should work fine after that.  I tested it.  (Fingers crossed that I won't look stupid.)
- (BOOL)isEqualToRepeatable:(id<Repeatable>)r {
    if (r.startDate != startDate) // Compiler error here
        return NO;
    return YES;
}

