Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/masashi-sutou/formcell
FormCell is customized UITableViewCell for entry form.
https://github.com/masashi-sutou/formcell
Last synced: about 1 month ago
JSON representation
FormCell is customized UITableViewCell for entry form.
- Host: GitHub
- URL: https://github.com/masashi-sutou/formcell
- Owner: masashi-sutou
- License: mit
- Created: 2017-02-19T13:55:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-11T17:17:28.000Z (almost 8 years ago)
- Last Synced: 2024-11-20T21:49:26.247Z (about 1 month ago)
- Language: Swift
- Homepage:
- Size: 107 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
FormCell
====## Overview
Demo |
--- |
|## Requirement
- Xcode 8
- Swift 3
- iOS 9.0 or later## Usage
```Swift// Example: - phone number in Japan
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = FormFieldCell(lengthError: (0, 11), pregError: (.phone, nil))
cell.editField(textChanged: { (text, error) inself.user.tel = text
if error.result {
self.user.errorMessages[indexPath] = error.message
} else {
self.user.errorMessages.removeValue(forKey: indexPath)
}}, didReturn: {
if let cell = tableView.cellForRow(at: indexPath) as? FormFieldCell {
cell.textField.resignFirstResponder()
}
})cell.textField.keyboardType = .numberPad
cell.textField.placeholder = "enter your phone number"
cell.textField.text = self.user.tel
return cell
}// Example: - save action
func saveTapped(_ sender: UIBarButtonItem) {
var message: String = ""
if self.user.errorMessages.isEmpty {message = "success to save"
} else {
for (_, s) in self.user.errorMessages {
message += s + "\n"
}
}self.showAlertDialog("Result", message: message, buttonTitle: "OK") {}
}```
## Installation
#### [CocoaPods](https://cocoapods.org/)
Add the following line to your Podfile:
```ruby
use_frameworks!target 'YOUR_TARGET_NAME' do
pod "FormCell"
end
```#### [Carthage](https://github.com/Carthage/Carthage)
Add the following line to your Cartfile:
```ruby
github "masashi-sutou/FormCell"
```## Licence
FormCell is available under the MIT license. See the LICENSE file for more info.