-
-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detecting a tap on the banner #9
Comments
You can use the completion handler to take an action: .toast(isPresenting: $showAlert, duration: 2, tapToDismiss: true, alert: {
//AlertToast Goes Here
}, completion: { dismissed in
//Completion block after dismiss (returns true)
}) Hope this answers your question. |
I tried that, but it's always called with true. So I can't differentiate between user tapping on to dismiss, or it just being auto dismissed after 2 seconds. The same complexion handler is called on both occasions. |
I've now added a new handler .toast(isPresenting: $showAlert, duration: 2, tapToDismiss: true, alert: {
//AlertToast Goes Here
}, onTap: {
//On tap would call either `tapToDismiss` is false/true
//If tapToDismiss is true, this action would call and then dismiss the alert
}, completion: {
//Completion block after dismiss WITHOUT escaping variables
}) Don't forget to set In the next update, all add this function as a function to Would look like this: AlertToast(type: .regular, title: "Next Update")
.onTap{
//Actions goes here
}
|
Amazing that’s great. Thanks. |
Is there an easy way to detect a tap on the banner in order to take an action if it was tapped or not.
The text was updated successfully, but these errors were encountered: