I am trying to display a picker where users can pick a Photo or a Video. I can only find explanations on how to respond to users picking a Photo. I'm not too familiar with UIKit so can someone help me out?
This is my picker function:
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
picker.dismiss(animated: true)
guard let provider = results.first?.itemProvider else {return}
if provider.canLoadObject(ofClass: UIImage.self) {
provider.loadObject(ofClass: UIImage.self) { image, _ in
self.parent.image = image as? UIImage
}
}
}