let currentSelectedCell = playersTableView.cellForRow(at: indexPath) as! PlayerDetailsTableViewCell if selectedRow == -1 { currentSelectedCell.playerDetailsView.layer.borderColor = hexStringToUIColor(hex: "F34141").cgColor currentSelectedCell.playerDetailsView.layer.borderWidth = 1 selectedRow = indexPath.row } else if indexPath.row == selectedRow { currentSelectedCell.playerDetailsView.layer.borderWidth = 0 selectedRow = -1 } else { currentSelectedCell.playerDetailsView.layer.borderColor = hexStringToUIColor(hex: "F34141").cgColor currentSelectedCell.playerDetailsView.layer.borderWidth = 1 let newIndexPath = IndexPath(item: selectedRow, section: 0) if let cell = playersTableView.cellForRow(at: newIndexPath) as? PlayerDetailsTableViewCell { cell.playerDetailsView.layer.borderWidth = 0 } selectedRow = indexPath.row }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter