I have a problem that I solved using delegates, but now I am thinking I may have made a mistake.
This is what I want to do.
I have a class that runs on a delay. When it is done it has a finished delegate that it calls.
Now I have the main class that creates two of these delay classes.
I don’t want them to both be handled by the same isfinished method in the main class. I want to use two different ones.
However I believe with the protocol method of creating delegates that this will not work for me.
Is there a way around this?
delayclass setdelegates MainclassFunction1
delayclass setdelegates MainclassFunction2
Using delegates doesn’t seem like the correct approach to me; they’re generally used for augmenting behavior. What sounds most appropriate here is the target/selector pattern, like NSTimer.
This is generally the cleanest approach since the delegate callback doesn’t need to disambiguate the sender. Using notifications seems like too much overhead for a problem in this domain.