wip
This commit is contained in:
parent
3361b828ef
commit
8da928e237
|
@ -388,24 +388,19 @@ struct CameraPicker: UIViewControllerRepresentable {
|
|||
}
|
||||
|
||||
func imagePickerController(_: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
|
||||
if let mediaType = info[.mediaType] as? UTType {
|
||||
switch mediaType {
|
||||
case .image:
|
||||
// swiftlint:disable:next force_cast
|
||||
let mediaType = info[.mediaType] as! String
|
||||
|
||||
if mediaType == UTType.image.identifier {
|
||||
if let image = info[.originalImage] as? UIImage {
|
||||
let data = image.jpegData(compressionQuality: 1.0) ?? Data()
|
||||
parent.completionHandler(data, .image)
|
||||
}
|
||||
|
||||
case .movie:
|
||||
} else if mediaType == UTType.movie.identifier {
|
||||
if let url = info[.mediaURL] as? URL {
|
||||
let data = try? Data(contentsOf: url)
|
||||
parent.completionHandler(data ?? Data(), .movie)
|
||||
}
|
||||
parent.completionHandler(Data(), .movie)
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue