My action buttons stopped working after Xcode update (Xcode 12). When I clicked the buttons, I saw that the functions did not working (like there is no button in there). I could not understand why. How can I fix these functions?
Here my action button function:
Here my button code:
Here my action button function:
Code Block @objc func addAction(sender: UIButton) { let indexPath = IndexPath(row: sender.tag, section: 0) let cell = tableView.cellForRow(at: indexPath) as! customCell cell.count += 1 cell.countBasketLabel.text = "x\(cell.count)" let detailGelen = detailsModel[indexPath.row] selectedItemName.append(detailGelen.itemDetailName!) selectedItemPrice.append(detailGelen.itemDetailPrice!) UserDefaults.standard.set(selectedItemName, forKey: "urunadi") UserDefaults.standard.set(selectedItemPrice, forKey: "urunfiyat") tableView.reloadData() }
Here my button code:
Code Block let addButton: UIButton = { let button = UIButton(type: .system) button.setImage(UIImage(named: "add"), for: .normal) button.tintColor = .black button.layer.cornerRadius = 5 button.addTarget(self, action: #selector(testdetail.addAction(sender:)), for: .touchUpInside) return button }()