Dynamic class creation in Objective-C

iphone, objective-c

Solution

You want `NSClassFromString`.

NSString *theClassForMe = @"NSMutableArray";
id newObject = [[NSClassFromString(theClassForMe) alloc] init];

Problem

Is there an equivalent of selectors for classes? How can I create a instance of a class from a string?

Original source