'How dismiss AppStoreOverlay

I'm trying to create an overlay to display an app banner and wish I could dismiss it with some conditions. I found the dismiss method in the Xcode documentation, but I don't know how to use it. Below is the part of code where I inserted the overlay.

Button("label") {
                    displayAppBanner.toggle()
                }
                .appStoreOverlay(isPresented: $displayAppBanner) {
                    SKOverlay.AppConfiguration(appIdentifier: "111111", position: .bottom)
                }

The variable is:

@Binding var displayAppBanner: Bool

Here the link to Xcode documentation: https://developer.apple.com/documentation/storekit/skoverlay/3566701-dismiss



Solution 1:[1]

If you want to programmatically dismiss the "banner", then make displayAppBanner = false in your code.

You could also do this for user interface dismiss:

    .appStoreOverlay(isPresented: $displayAppBanner) {
        let config = SKOverlay.AppConfiguration(appIdentifier: "1440611372", position: .bottom)
        config.userDismissible = true
        return config
    }
    

then, swipe-down the banner to dismiss it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 workingdog support Ukraine