I have added 2 buttons to my SwiftEntryKit popup but cannot figure out how to do something after a button is pressed.
I follow the pattern set with their example for alerts.
I tried entering something into the dismiss action, but it did not work:
// Ok Button
let okButtonLabelStyle = EKProperty.LabelStyle(font: buttonFont, color: buttonColor)
let okButtonLabel = EKProperty.LabelContent(text: "OK, ACCEPT", style: okButtonLabelStyle)
let okButton = EKProperty.ButtonContent(label: okButtonLabel, backgroundColor: .clear, highlightedBackgroundColor: buttonColor.withAlphaComponent(0.05)) {
SwiftEntryKit.dismiss {
print("okButton")
}
}
Thank you.
You have to set entryInteraction
to .absorbTouches
for the attributes
property of SwiftEntryKit.display
.
var attributes = EKAttributes()
attributes.entryInteraction = .absorbTouches
[...]
SwiftEntryKit.display(entry: <entry variable>, using: attributes)