title: How do I specify that a non-generic Swift type should comply to a protocol?
body: <p>I'd like to implement a Swift method that takes in a certain class type, but only takes instances of those classes that comply to a specific protocol. For example, in Objective-C I have this method: </p>
  
  <pre><code>- (void)addFilter:(GPUImageOutput&lt;GPUImageInput&gt; *)newFilter;
  </code></pre>
  
  <p>where <code>GPUImageOutput</code> is a particular class, and <code>GPUImageInput</code> is a protocol. Only <code>GPUImageOutput</code> classes that comply to this protocol are acceptable inputs for this method.</p>
  
  <p>However, the automatic Swift-generated version of the above is </p>
  
  <pre><code>func addFilter(newFilter: GPUImageOutput!)
  </code></pre>
  
  <p>This removes the requirement that <code>GPUImageOutput</code> classes comply with the <code>GPUImageInput</code> protocol, which will allow non-compliant objects to be passed in (and then crash at runtime). When I attempt to define this as <code>GPUImageOutput&lt;GPUImageInput&gt;</code>, the compiler throws an error of </p>
  
  <blockquote>
    <p>Cannot specialize non-generic type 'GPUImageOutput'</p>
  </blockquote>
  
  <p>How would I do such a class and protocol specialization in a parameter in Swift?</p>