How to make a cell on a UITableView not selectable?

To remove the ability of selecting any table cells, or particular table cells based on the row index, use willSelectRowAt

func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {


        return nil
    }

To simply remove the UI effect of selecting the element, set the selection style of the UITableViewCell to UITableViewCellSelectionStyleNone

Swift 5:

selectionStyle = .none

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)