1

Kind of new to Swift in general, but I'm trying to make a simple RAW camera app for fun. Apple's documentation says that to configure a photo output, you do

  let query = photoOutput.isAppleProRAWEnabled ?
        { AVCapturePhotoOutput.isAppleProRAWPixelFormat($0) } :
        { AVCapturePhotoOutput.isBayerRAWPixelFormat($0) }

    // Retrieve the RAW format, favoring Apple ProRAW when enabled.
guard let rawFormat =
            photoOutput.availableRawPhotoPixelFormatTypes.first(where: query) else {
        fatalError("No RAW format found.")
    }

but I've been getting an error with the first let statement which says "'isAppleProRAWEnabled' is only available in iOS 14.3 or newer." Is there any way to force it to check for ProRaw, even not on iOS 14.3? I'm not even interested in using ProRaw, but I can't figure out how to get rid of the check and just select the classic RAW format (which I think is the bayer format). If anyone knows a workaround, that would be great!

1 Answers1

0

You can query for the Bayer RAW format as below:

let rawFormatQuery = {AVCapturePhotoOutput.isBayerRAWPixelFormat($0)}
guard let rawFormat = photoOutput.availableRawPhotoPixelFormatTypes.first(where: rawFormatQuery) else {
            fatalError("No RAW format found.")
        }

Then you set your photo settings using the raw format:

let photoSettings = AVCapturePhotoSettings(rawPixelFormatType: rawFormat,
                                                       processedFormat: processedFormat)

Finally, you call your capture delegate as described in the Apple documentation (which I think is where you got the code above). https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/capturing_photos_in_raw_and_apple_proraw_formats

Salvo89
  • 13
  • 6