I'm trying to convert this code to swift, but I keep getting an error in the if-statement, the objective-c code looks like this:
AVCaptureStillImageOutput *stillImageOutPut;
AVCaptureConnection *videoConnection = nil;
for (AVCaptureConnection *connection in stillImageOutput.connections){
for (AVCaptureInputPort *port in [connection inputPorts]){
if ([[port mediaType] isEqual:AVMediaTypeVideo]){
videoConnection = connection;
break;
}
}
}
and my Swift code looks like this:
let stillImageOutPut = AVCaptureStillImageOutput()
let videoConnection:AVCaptureConnection? = nil
for connection in stillImageOutPut.connections{
for port in [connection.inputPorts]{
if
}
}
in the if-statement I can't find the .mediaType
and the autocomplete says description
, getMirror
and map
. I've tried casting the types in the for-loop in other ways but I just get keep getting errors.
Any suggestions on how to create this for-loop correctly would be appreciated.