Skip to content

Instantly share code, notes, and snippets.

@ianhirschfeld
Last active June 23, 2017 20:20
Show Gist options
  • Save ianhirschfeld/f8c286d6e62a8f152dab303a817330d9 to your computer and use it in GitHub Desktop.
Save ianhirschfeld/f8c286d6e62a8f152dab303a817330d9 to your computer and use it in GitHub Desktop.
Example of setting up an enum for UITableView sections.
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