I have reviewed the WWDC2020 video explaining how to adopt the new PHPickerViewController API. I have also seen several blogs showing exactly the following code.
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
if let result = results.first, result.itemProvider.canLoadObject(ofClass: UIImage.self) {
result.itemProvider.loadObject(ofClass: UIImage.self) { (image, error) in
DispatchQueue.main.async {
self.parent.didCapture(image)
}
}
} else {
parent.didCapture(nil)
}
}
However, this fails for me and the error is quite bizarre.
UIImage must confirm to _ObjectiveCBridgable
I will include a screenshot because it is quite unbelievable
Hardware: M1 chipset
IDE: Xcode 12.4