Created
August 9, 2015 20:01
-
-
Save tomkowz/92762762c34dec2aad89 to your computer and use it in GitHub Desktop.
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 LetItGoTableViewController: UITableViewController { | |
private enum SignInField: Int { | |
case Username | |
case Password | |
case RememberMe | |
case SignInButton | |
} | |
// MARK: - Table view data source | |
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return 4 | |
} | |
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
let identifier: String = { | |
guard let type = SignInField(rawValue: indexPath.row) else { return "defaultCell" } | |
switch type { | |
case .Username: return "textFieldCell" | |
case .Password: return "secureTextFieldCell" | |
case .RememberMe: return "switchWithTextCell" | |
case .SignInButton: return "buttonCell" | |
} | |
}() | |
let cell = tableView.dequeueReusableCellWithIdentifier(identifier, forIndexPath: indexPath) | |
// cell configuration goes here | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment