SwiftUI: Clickable links or buttons in alert

Viewed 95

I have made an alert into my app that pops up when user opens the app for the first time and I would like it to have the accept button and 2 more buttons that are a link to my privacy policy and terms and conditions. Here is the alerts code that I currently have.

.alert(isPresented: $alertShouldBeShown, content: {
                
    Alert(title: Text("Thank you for downloading this app"),
    message: Text("By tapping the button, you agree to accept the terms and conditions and the privacy policy"),
    primaryButton: Alert.Button.default(
    Text("Continue & Accept"), action: {
    UserDefaults.standard.set(true, forKey: "FirstStart")
    })
)
})

I have only been able to make another button using the secondaryButton: but I would like to have 3 buttons in total. How would it be possible? Thank you.

Is it even possible since SwiftUI gives two buttons so I just should make a new view that has all the necessary links and buttons and when pressed accept it goes into the main view?

1 Answers

You could use a Link in the body of your alert.

Related