我们如何在使用 Eureka 单击单元格后执行条件

How do we perform a condition after we click on a cell using Eureka

我正在使用以下代码:

<<< ButtonRow("MyCell") { [=10=].title = [=10=].tag [=10=].presentationMode = .segueName(segueName: "ShowMyScreen", onDismiss: nil) }

现在,我需要对点击和移动执行条件,仅当它为真时才显示,如果为假则显示警报。如果用户从警报中单击“确定”,则移动。 我该怎么做?

使用.onCellSelection闭包

您的要求的示例代码

<<< ButtonRow("MyCell") { [=10=].title = [=10=].tag
                }.onCellSelection({ (cell, row) in
                    if(yourCondition)
                    {
                       self.performSegue(withIdentifier: "ShowMyScreen", sender: nil)
                    }else{
                        let alert = UIAlertController(title: "test", message: "test", preferredStyle: .alert)
                        let action = UIAlertAction(title: "OK", style: .default, handler: { (action) in
                            self.performSegue(withIdentifier: "ShowMyScreen", sender: nil)
                        })
                        let action2 = UIAlertAction(title: "Cancel", style: .default, handler: nil)
                        alert.addAction(action)
                        alert.addAction(action2)
                        self.present(alert, animated: true, completion: nil)
                    }
                })