in swift UIKit I am trying to display a group of photos and videos through PHPicker
The pictures appear with me, but the video shows a white picture
I don't know where the error is, if someone can explain to me
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
dismiss(animated: true, completion: nil)
//For Image
for result in results {
result.itemProvider.loadObject(ofClass: UIImage.self) { image, error in
if let image = image as? UIImage {
DispatchQueue.main.async {
self.arrS1.append(addCatogrey(imageSection: image))
self.SelectImage = image
self.collection.reloadData()
}
}
}
//For Video
result.itemProvider.loadItem(forTypeIdentifier: UTType.movie.identifier, options: nil) { video, error in
if let video = video as? URL {
DispatchQueue.main.async {
self.arrS1.append(addCatogrey(videoSection: video))
self.SelectVideo = video
self.collection.reloadData()
}
}
}
}
}
My Cell
class CVCell: UICollectionViewCell {
@IBOutlet weak var imgMenu: UIImageView!
@IBOutlet weak var textMenu: UILabel!
var playerController = AVPlayerViewController()
var addModel : addCatogrey! {
didSet {
self.textMenu.text = addModel.nameCatog
self.imgMenu.image = addModel.imageSection
}
}
}
My Model
var nameCatog : String?
var imageSection : UIImage?
var videoSection : URL?
}