Skip to content

Instantly share code, notes, and snippets.

@ispiropoulos
Created January 26, 2015 15:55
Show Gist options
  • Save ispiropoulos/b6a0eee7813b1e512a6d to your computer and use it in GitHub Desktop.
Save ispiropoulos/b6a0eee7813b1e512a6d to your computer and use it in GitHub Desktop.
Switch indexPath.section & indexPath.row using tuple
let indexPosition = (indexPath.section, indexPath.row)
switch indexPosition {
case (0, 0):
cell.textLabel?.text = "Section 0 - Row 0"
case (0, 1):
cell.textLabel?.text = "Section 0 - Row 1"
case (0, 2):
cell.textLabel?.text = "Section 0 - Row 2"
case (1, 0):
cell.textLabel?.text = "Section 1 - Row 0"
case (1, 1):
cell.textLabel?.text = "Section 1 - Row 1"
case (1, 2):
cell.textLabel?.text = "Section 1 - Row 2"
default:
cell.textLabel?.text = "default text¯"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment