Skip to content

UITableViewController with a UITextField inside each UITableViewCell

Notifications You must be signed in to change notification settings

acani/TextFieldTableViewController

Repository files navigation

TextFieldTableViewController

A UITableViewController with a UITextField inside each UITableViewCell

Setup: How to add a Git repository to your Xcode project

Usage:

import UIKit
import TextFieldTableViewController

class EnterEmailTableViewController: TextFieldTableViewController {
  init() {
    super.init(title: "Enter Email", placeholders: [["Email"]], texts: [[""]])
  }

  // MARK: - NSCoding

  required init?(coder: NSCoder) { fatalError("init(coder:) hasn't been implemented") }

  // MARK: - TextFieldTableViewController

  override func configureTextField(_ textField: UITextField, forRowAt indexPath: IndexPath) {
    super.configureTextField(textField, forRowAt: indexPath)
    textField.autocapitalizationType = .none
    textField.keyboardType = .emailAddress
  }

  // MARK: - Actions

  override func doneAction() {
    let email = texts[0][0].trimmingCharacters(in: .whitespacesAndNewlines)
    print("Email entered: \(email)")
  }
}

Released under the Unlicense.

About

UITableViewController with a UITextField inside each UITableViewCell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages