Last active
June 23, 2017 20:20
-
-
Save ianhirschfeld/f8c286d6e62a8f152dab303a817330d9 to your computer and use it in GitHub Desktop.
Example of setting up an enum for UITableView sections.
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
class ViewController: UIViewController { | |
// The magic enum to end our pain and suffering! | |
// For the most part the order of our cases do not matter. | |
// What is important is that our first case is set to 0, and that our last case is always `total`. | |
enum TableSection: Int { | |
case action = 0, comedy, drama, indie, total | |
} | |
// This is the size of our header sections that we will use later on. | |
let SectionHeaderHeight: CGFloat = 25 | |
// Data variable to track our sorted data. | |
var data = [TableSection: [[String: String]]]() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment