Converting YCbCr to RGB with Metal is only needed if you intend to render the captured image with Metal (sample project demonstrating how). The simplest way to obtain a PNG image is with CoreImage:
// The file can be accessed in Finder if you set UIFileSharingEnabled to YES in your
// Info.plist.
guard let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return }
// If you want to save multiple PNG images, it's best practice to reuse the same CIContext.
let context = CIContext()
let image = CIImage(cvPixelBuffer: frame.capturedImage)
let png = context.pngRepresentation(of: image, format: .BGRA8, colorSpace: image.colorSpace!)
try? png?.write(to: documentsURL.appending(component: "captured-image.png"))