Value of type 'AVCapturePhotoSettings' has no member 'availablePreviewPhotoPixelFormatTypes

In beta 4 this got renamed to __availablePreviewPhotoPixelFormat. I haven't looked at beta 5 yet.


I experienced the same problem after upgrading to Xcode 12.0

It seems that settings.availablePreviewPhotoPixelFormatTypes has been changed to settings.__availablePreviewPhotoPixelFormatTypes again in the Final Xcode Release: Version 12.0 (12A7209). I have been using it without the 'rename' for at least 2 years. Thx to @Matthijs Hollemans for the help

EDIT: This is the official response with regards to this change: https://developer.apple.com/forums/thread/86810?answerId=259270022#259270022

This code compiles OK.

let settings = AVCapturePhotoSettings()
guard let previewPixelType = settings.__availablePreviewPhotoPixelFormatTypes.first else { return }
let previewFormat = [
    kCVPixelBufferPixelFormatTypeKey as String: previewPixelType,
    kCVPixelBufferWidthKey as String: 160,
    kCVPixelBufferHeightKey as String: 160
]
settings.previewPhotoFormat = previewFormat
output.capturePhoto(with: settings, delegate: self)