Reputation: 306
I'm using performSegue in UItableView didselect method with switch case, Sometimes it performs segue on single tap and sometimes double tap. I'm using 2 sections in UITableView if someone can help me with this issue? Here is didselect code
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 0 {
if let vc = storyboard?.instantiateViewController(withIdentifier: "NotificationVC") as? NotificationVC {
vc.link = "NOTIFICATION"
vc.modalPresentationStyle = .fullScreen
present(vc, animated: true, completion: nil)
}
} else {
let identifier = banners[indexPath.row].link
switch identifier{
case "GOLD":
print("Move to \(identifier!)")
performSegue(withIdentifier: "vouchGold", sender: self)
case "RETAIL":
print("Move to \(identifier!)")
performSegue(withIdentifier: "vouchRetail", sender: self)
case "FUSION":
print("Move to \(identifier!)")
// performSegue(withIdentifier: "vouchRetail", sender: selfr)
if let vc = storyboard?.instantiateViewController(withIdentifier: "fusions") as? HomeVC {
vc.linkType = "FUSION"
present(vc, animated: true, completion: nil)
}
case "SOCIAL":
performSegue(withIdentifier: "vouchSocial", sender: self)
case "TRAVEL":
print("Move to \(identifier!)")
performSegue(withIdentifier: "vouchTravel", sender: self)
case "EVENTS":
print("Move to \(identifier!)")
performSegue(withIdentifier: "vouchEvents", sender: self)
case "WHATSAPP":
print("Move to \(identifier!)")
performSegue(withIdentifier: "vouchWhatsapp", sender: self)
default :
link = banners[indexPath.row].link
performSegue(withIdentifier: "vouchURL", sender: self)
print("No Identifier \(String(describing: self.banners[indexPath.row].link))")
}
}
}
Thanks in advance. Regards.
Upvotes: 0
Views: 101
Reputation: 100503
Clear the focus with this line end of didSelectRowAt
tableView.deselectRow(at: indexPath, animated: false)
Upvotes: 2