Dismiss a SwiftUI View that is contained in a UIHostingController
问题 I have rewritten my sign in view controller as a SwiftUI View . The SignInView is wrapped in a UIHostingController subclass ( final class SignInViewController: UIHostingController<SignInView> {} ), and is presented modally, full screen, when sign in is necessary. Everything is working fine, except I can't figure out how to dismiss the SignInViewController from the SignInView . I have tried adding: @Environment(\.isPresented) var isPresented in SignInView and assigning it to false when sign in