I tried various ways to instantiate the class: AVCapturePhotoSettings as listed below:
let settings = AVCapturePhotoSettings(format: [ kCVPixelBufferPixelFormatTypeKey : "BGRA"] )
let settings = AVCapturePhotoSettings(format: [ kCVPixelBufferPixelFormatTypeKey as String : "BGRA"] )
let settings = AVCapturePhotoSettings(format: [ String( kCVPixelBufferPixelFormatTypeKey) : "BGRA"]
let settings = AVCapturePhotoSettings(format: [ "kCVPixelBufferPixelFormatTypeKey" : "BGRA"] )
The first method gets the error:
Cannot convert value of type 'CFString' to expected dictionary key type 'String'
and so the three other attempts below this were done, but each of these attempts got the run time error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[AVCapturePhotoSettings photoSettingsWithFormat:] Either kCVPixelBufferPixelFormatTypeKey or AVVideoCodecKey must be specified'
What is the correct way to use this initiator for the class: AVCapturePhotoSettings ?