I would like to store a Class object in an NSMutableDictionary and then instantiate a copy later based on the key (specifically an NSNotification name). But unfortunately I can’t find out what type of object ‘Class’ is in Objective-C, and its hard to google for. It’s definitely not of a type ‘id’ so it won’t go in the dictionary normally:
warning: Semantic Issue: Incompatible pointer types sending 'Class *' to parameter of type 'id'
Alternately I can store the Class’ name in the dictionary, and use NSClassFromString to instantiate the class. It seems silly to use NSStringFromClass to put the Class in the Dictionary, and then NSClassFromString to get the class again. Is this my best option?
You can store a
Classinto a dictionary, e.g.In fact, a
Classis compatible withid. Note that you don’t need a*afterClass. It’s likeid.