title: Objective C create object by class
body: <p>I would like to know how to create an object of the specified <code>Class</code> in objective c. Is there some method I am missing in the runtime docs? If so what is it? I would like to be able to do something like the following:</p>
  
  <pre><code>NSDictionary *types;
  
  -(id&lt;AProtocol&gt;) createInstance:(NSString *) name
  {
      if ((Class cls = [types objectForKey:name]) != nil)
      {
         return new Instance of cls;
      }
      else
      {
          [NSException raise:@"class not found" format:@"The specified class (%@) was not found.", name];
      }
  }
  </code></pre>
  
  <p>please note that name is not a name of the class, but an abbreviation for it, and I cannot do what is indicated in <a href="https://stackoverflow.com/questions/2951828/create-object-from-nsstring-of-class-name-in-objective-c">Create object from NSString of class name in Objective-C</a>.</p>