stleamist / BetterSafariView

A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI.
MIT License
581 stars 57 forks source link

View opens twice #15

Open 1234igor opened 3 years ago

1234igor commented 3 years ago

Hi! Just pasted example code into my project:

`... .onTapGesture() {

                        self.presentingSafariView = true

                    }.safariView(isPresented: $presentingSafariView) {
                        SafariView(
                            url: URL(string: "https://google.com")!,
                            configuration: SafariView.Configuration(
                                entersReaderIfAvailable: false,
                                barCollapsingEnabled: true
                            )
                        )
                        .preferredBarAccentColor(.clear)
                        .preferredControlAccentColor(.accentColor)
                        .dismissButtonStyle(.done)
                    }`

When I tap, the Safari View opens two times, and I need to close two Safaris to get back into my app. Any ideas what could be causing this?

1234igor commented 3 years ago

Thank you, I've found solution in another thread.

Moving my row code into a separate view with its own url variable helped.

ChopsKingsland commented 3 years ago

Can you give more information, please, as I am having the same issue?

litt1e-p commented 3 years ago

append .safariView( to wrapper view will do helped