MSFormCell 1.0.5

MSFormCell 1.0.5

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Mar 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by owner.



  • By
  • masashi-sutou

MSFormCell

Overview

Demo

Requirement

  • Xcode 8
  • Swift 3
  • iOS 8.0 or later

Usage

// Example: phone number in Japan

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell = MSFormCell(lengthError: (0, 11), pregError: (.phone, nil))
    cell.editField(beginEditing: nil, textChanged: { (text) in
        self.user.tel = text
    }, didReturn: {
        if let cell = tableView.cellForRow(at: indexPath) as? MSFormCell {
            cell.textField.resignFirstResponder()
        }
    })

    cell.textField.keyboardType = .numberPad
    cell.textField.placeholder = "enter your phone number"
    cell.textField.text = self.user.tel
    return cell
}

Licence

MSFormCell is available under the MIT license. See the LICENSE file for more info.