title: Swift array of struct types conforming to protocol
body: <p>I have a series of several <code>struct</code>s conforming to <code>MyProtocol</code>. I need an array of these structs' <em>types</em> (because they have a static method declared in <code>MyProtocol</code> that I need to be able to access). I have tried all kinds of things but I can't make Xcode like it.</p>
  
  <p>Also, before this is marked as dupe – I tried <a href="https://stackoverflow.com/questions/28690399/declare-array-of-classes-that-conform-to-a-protocol">this</a>, but all I got was:</p>
  
  <pre><code>//Foo and Bar are structs conforming to MyProtocol
  
  let MyStructArray: Array&lt;MyProtocol.self&gt; = [Foo.self, Bar.self]
  //Protocol 'MyProtocol' can only be used as a generic constant because it has Self or associated type requirements
  </code></pre>