在 SwiftEntryKit 中按下条目的按钮后执行操作

dio*_*nes 3 swift

我在SwiftEntryKit弹出窗口中添加了 2 个按钮,但在按下按钮后无法弄清楚如何执行某些操作。

我遵循他们的警报示例设置的模式。

我尝试在解雇操作中输入一些内容,但没有用:

// 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")
    }

}
Run Code Online (Sandbox Code Playgroud)

谢谢你。

Tam*_*gel 6

你必须设置entryInteraction.absorbTouchesattributes财产SwiftEntryKit.display

var attributes = EKAttributes()
attributes.entryInteraction = .absorbTouches

[...]

SwiftEntryKit.display(entry: <entry variable>, using: attributes)
Run Code Online (Sandbox Code Playgroud)