Open OrkhanAlikhanov opened 3 years ago
How can I dismiss the view controller programmatically? Following minimal example does not work:
struct MyView: View { @State var showView = false var body: some View { let _ = print("current value: \(showView)") Button("Show it") { print("showing it") showView = true DispatchQueue.main.asyncAfter(deadline: .now() + 2) { print("hiding it") showView = false } } .safariView(isPresented: $showView) { SafariView(url: URL(string: "https://www.google.com")!) } } }
Log:
current value: false showing it current value: true hiding it current value: false
According to my debugging, view modifier does not detect that the value of the binding changed, this might be related: https://stackoverflow.com/questions/59299260/swiftui-binding-update-doesnt-refresh-view
I am having the same issue. Were you able to find a solution?
I resorted to presenting SFSafariController and managing it myself for this particular case
How can I dismiss the view controller programmatically? Following minimal example does not work:
Log:
According to my debugging, view modifier does not detect that the value of the binding changed, this might be related: https://stackoverflow.com/questions/59299260/swiftui-binding-update-doesnt-refresh-view