Skip to content

Instantly share code, notes, and snippets.

@tomkowz
Created August 9, 2015 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomkowz/92762762c34dec2aad89 to your computer and use it in GitHub Desktop.
Save tomkowz/92762762c34dec2aad89 to your computer and use it in GitHub Desktop.
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