Skip to content

Instantly share code, notes, and snippets.

@c1800054work
Created June 21, 2022 08:31
Show Gist options
  • Select an option

  • Save c1800054work/fe7c5cc89bb2dd8adf95c229410e7786 to your computer and use it in GitHub Desktop.

Select an option

Save c1800054work/fe7c5cc89bb2dd8adf95c229410e7786 to your computer and use it in GitHub Desktop.
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let rawValue = indexPath.section*100 + indexPath.row
switch TableIndex(rawValue: rawValue) {
case .a:
// do something
case .b:
// do something
}
}
private enum TableIndex: Int, CaseIterable {
//rawValue = indexPath.section*100 + indexPath.row
case a = 100 //a
case b = 101 //b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment