0

I have a line of code from Obj-C:

GPUImageOutput<GPUImageInput> *filter;

How can I convert it to Swift? I try some solutions but it doesn't work :(

var filter = GPUImageOutput<GPUImageInput>
var filter:GPUImageOutput = GPUImageOutput<GPUImageInput>
HoangNA
  • 163
  • 1
  • 12
  • also: [What's the Swift equivalent of declaring `typedef SomeClass MyType`?](http://stackoverflow.com/questions/26474061) – rintaro Apr 03 '15 at 13:38

1 Answers1

2

This is not a generic in Objective-C. Obj-C does not support generics.

That notation is used to indicate protocol conformance. So it is declared as a GPUImageOutput that implemente the GPUImageInput protocol.

I believe it can be translated to this in Swift:

var filter: GPUImageInput
// or
var filter: GPUImageOutput
Rengers
  • 14,911
  • 1
  • 36
  • 54