title: Object initialization with protocol and class name in swift
body: <p>In Ojective-C I wrote: </p>
  
  <pre><code>id &lt;MyProtocol&gt; object = [[NSClassFromString(@"aClassName") alloc] initWithObject:obj];
  </code></pre>
  
  <p>I would like to write this in Swift.</p>
  
  <p>Is there to do the same or am I out of the language paradigm ?</p>
  
  <p>edit :</p>
  
  <p>Here's my context.
  Somewhere I have :</p>
  
  <pre><code>- (instancetype)initWithObject:(NSArray *)array andClassName:(NSString *)className {
      self = [self initWithClassName:className];
      if(self) {
          _members    = [[NSMutableArray alloc] init];
          for(id obj in array) {
              id &lt;MyProtocol&gt; object = [[NSClassFromString(className) alloc] initWithObject:obj];
              [_members addObject:object];
          };
      }
      return self;
  }
  </code></pre>