- Instantiate UIHosting Controller
- pass a reference to
self
which is of type UIDocumentBrowserViewController
//This is somewhere in the present method of my UIDBVC subclass
let documentViewController = UIHostingController(rootView: SomeView(rootVC: self))
* In the UIDBVC subclass I created this method
```swift
func dismissVC() {
dismiss(animated: true, completion: nil)
}
- The SwiftUI View calls the
dismissVC
method of the UIDBVC subclass
struct SomeView: View {
var rootVC: myDocumentBrowserViewControllerSubclass
var body: some View{
Button(
action: { self.rootVC.dismissVC() },
label: { Text("Dismiss this View") }
)
}
}