Using an NSMutableArray ivar, I plan to write a class that acts like a stack and which objects of various types should be able to be retrieved from.
Whenever that stack threatens to run out of objects because almost all have yet been retrieved, it should automatically push new objects onto itself by fetching them from some sort of as-generic-as-possible "object emitter". For example, there should be supplicant classes which return instances of NSImages or of NSString or any other imaginable types which should be put on the stack but each have to be treated in a separate way beforehand.
What would be the easiest pattern of "plugging in" those object emitting classes into my stack class? The stack class should not need to be aware of the object types it has to deal with, this is where some "helper classes" might set it - but I have no clue where their place would be. I tried Dynamic Creation using NSClassFromString but that just doesn't feel quite right.