I wanted to expose an IBOutletCollection for all my UIViewController classes without using inheritance, so I tried like that using the objc runtime, but the is never called. Any idea why ?
@interface UIViewController (MyCategory)
@property (nonatomic, strong) IBOutletCollection(UIView) NSArray<UIView *> * items;
@end
@implementation UIViewController (MyCategory)
- (void)setItems:(NSArray<UIView *> *)items
{
objc_setAssociatedObject(self, "items", items, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSArray<UIView *> *)items
{
return objc_getAssociatedObject(self, "items");
}
@end
Problem solved, I was not using the IBOutletCollection for the view controller where I enabled the breakpoint :D