'SwiftUI: How can I display an alert on the very first start

I'm new in SwiftUI and I would like to show an alert when the user start the app for the first time. If the user opens the app a second (or third...) time, the alert should not come anymore.

struct ContentView: View {

    @State var alertShouldBeShown = true   
    
    var body: some View {
        VStack {
            Text("Hello World!")
            
            .alert(isPresented: $alertShouldBeShown, content: {

                Alert(title: Text("Headline"),
                      message: Text("Placeholder"),
                      dismissButton: Alert.Button.default(
                        Text("Accept"), action: {
                      }
                    )
                )
            })
        }
    }
}


Solution 1:[1]

import SwiftUI

struct ContentView: View {
    @State private var isAlert = false

    var body: some View {
            Button(action: {
                self.isAlert = true
            }) {
                Text("Click Alert")
                .foregroundColor(Color.white)
            }
            .padding()
            .background(Color.blue)
            .alert(isPresented: $isAlert) { () -> Alert in
                Alert(title: Text("iOSDevCenters"), message: Text("This Tutorial for SwiftUI Alert."), primaryButton: .default(Text("Okay"), action: {
                    print("Okay Click")
                }), secondaryButton: .default(Text("Dismiss")))
        }

    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

enter image description here

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 Fatemeh