1

I'm working on building a UICollectionView subclass to cover up more convenient layouts in a simple way. It needs to have another delegate property to handle messages from custom UICollectionViewLayout class, which the UICollectionView class already has, so I wish the delegate property of UICollectionView handles both UICollectionViewDelegate and another custom delegate protocol.

More specifically, I'd like to build something like the followings.

@interface CPGridCollectionView : UICollectionView <CPGridLayoutDelegate>

// add protocol declaration to existing delegate property
@property (nonatomic, weak, nullable) id<UICollectionViewDelegate, CPGridLayoutDelegate> delegate;

// more additional features

@end

But warning came up as:

Auto property synthesis will not synthesize property 'delegate'; it will be implemented by its superclass, use @dynamic to acknowledge intention

It seems that I need to add attributes to existing property of UICollectionView, without breaking the functionality of UICollectionViewDelegate. Is this possible in Obj-C, and how can this warning be avoided?

shallowThought
  • 19,212
  • 9
  • 65
  • 112
Tack-Gyu Lee
  • 448
  • 3
  • 11
  • This is answered here: http://stackoverflow.com/questions/30911655/swift-extending-a-delegate-from-a-base-class – ptoinson Jan 23 '17 at 09:26

0 Answers0