How can I implement a class/object that has a reference to a bunch of non-retained id
objects?
I want something similar to what UIControl
/NSControl
has: addTarget:(id)target action:(SEL)action ...;
(in my case, though, I don't need the UIControlEvents
part). I want to use this target/action pattern (and preferably stay away from the delegate pattern) but for that I need to make sure the targets added to my object are not retained or retain cycles might happen.
I think implementing my own array using malloc
/free
to make sure targets are not retained would be one solution, but all this hassle smells like there is already a solution implemented somewhere. Is there?