Created
January 26, 2015 15:55
-
-
Save ispiropoulos/b6a0eee7813b1e512a6d to your computer and use it in GitHub Desktop.
Switch indexPath.section & indexPath.row using tuple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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