presentationMode -> dismiss

This commit is contained in:
Thomas Ricouard 2023-12-04 14:14:42 +01:00
parent 4a09989160
commit 3840b8fb28

View file

@ -3,7 +3,7 @@ import UIKit
struct StatusEditorCameraPickerView: UIViewControllerRepresentable {
@Binding var selectedImage: UIImage?
@Environment(\.presentationMode) var isPresented
@Environment(\.dismiss) var dismiss
class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
let picker: StatusEditorCameraPickerView
@ -15,7 +15,7 @@ struct StatusEditorCameraPickerView: UIViewControllerRepresentable {
func imagePickerController(_: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
guard let selectedImage = info[.originalImage] as? UIImage else { return }
picker.selectedImage = selectedImage
picker.isPresented.wrappedValue.dismiss()
picker.dismiss()
}
}