title: How to create a swift generic variadic function?
body: <p>Here is my code</p>
  
  <pre><code>protocol P {}
  class BaseClass {}
  class AA: BaseClass, P {}
  class BB: BaseClass {}
  class CC: BaseClass, P {}
  
  
  func test1&lt;T&gt;(value: T.Type...) where T: BaseClass &amp; P {
  }
  </code></pre>
  
  <p>Here we have 2 subclasses of BaseClass <code>AA</code> and <code>BB</code>. </p>
  
  <p><code>AA</code> and <code>CC</code> <strong>conforms</strong> to protocol <code>P</code>. <code>BB</code> <strong>does not</strong> conform to protocol <code>P</code>.</p>
  
  <p>how do i use the function to only accept multiple parameters <code>AA</code> and <code>CC</code> but reject <code>BB</code> ?</p>
  
  <p>I have tried this:</p>
  
  <pre><code>test(AA.self, BB.self)
  </code></pre>
  
  <p>This gives me a compile time error. Is there any way I can achieve the behavior above?</p>