I'm using the following piece of code to show the default UIImagePickerController, but it seems that the the iOS 13's drag-down to dismiss gesture isn't working with UIImagePickerController wrapped in a SwiftUI view, the user still can hit the default Cancel tab bar item in order to dismiss the picker, the code:
struct ContentView: View {
@State private var showModal = false
var body: some View {
Text("Tap To show modal")
.padding()
.onTapGesture {
self.showModal.toggle()
}
.sheet(isPresented: $showModal) {
SomeUIKitView()
}
}
}
final class SomeUIKitViewControllerWrapper: UIViewControllerRepresentable {
typealias UIViewControllerType = UIImagePickerController
func makeUIViewController(context: Context) -> UIImagePickerController {
let imagePicker = UIImagePickerController()
imagePicker.sourceType = UIImagePickerController.SourceType.photoLibrary
return imagePicker
}
func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {}
}
struct SomeUIKitView: View {
var body: some View {
SomeUIKitViewControllerWrapper()
}
}
