Jailpod
Jailpod

Reputation: 150

Delegate Help - Using class the delegate is for inside the delegate

How would I use the class that the delegate is for inside of the protocol methods.

Ex:

@protocol ILMIconDelegate <NSObject>
- (void)deleteIcon:(ILMIcon *)icon;
@end

@interface ILMIcon : UIView <IconPopoverViewControllerDelegate>

...

@end

This doesn't work because I can't use (ILMIcon *) inside the protocol as it's declared later in the file. Any help?

Is there any work around, or should I just use (UIView *) instead?

Thanks

Edit: newacct gave me the answer of using @class ILMIcon; before the protocol and it works! Thanks alot man!

Upvotes: 0

Views: 48

Answers (1)

newacct
newacct

Reputation: 122439

You can forward-declare the class before the protocol declaration, like:

@class ILMIcon;

Upvotes: 1

Related Questions