https://github.com/goergisn/codeinputfield
An input field allowing the user to enter digits
https://github.com/goergisn/codeinputfield
input inputfield ui-components uikit
Last synced: 9 months ago
JSON representation
An input field allowing the user to enter digits
- Host: GitHub
- URL: https://github.com/goergisn/codeinputfield
- Owner: goergisn
- License: mit
- Created: 2020-10-27T15:06:07.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2020-10-30T14:32:31.000Z (about 5 years ago)
- Last Synced: 2024-12-18T15:37:16.198Z (about 1 year ago)
- Topics: input, inputfield, ui-components, uikit
- Language: Swift
- Homepage:
- Size: 254 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeInputField
An input field allowing the user to enter digits
[](https://swift.org/package-manager/)
## Usage

```Swift
// Obfuscated input field that shows a 🔒 instead of the actual digits
let secureInputField = CodeInputField(segments: (0..<4).map { _ in
let segment = CodeInputField.DefaultSegment(inputOverride: "🔒")
segment.tintColor = .purple
segment.inputColor = .white
segment.backgroundColor = segment.tintColor?.withAlphaComponent(0.3)
segment.nonEmptyBackgroundColor = .purple
return segment
}, shouldClearInputWhenBecomingFirstResponder: true)
```

```Swift
// Generic code input field with custom radius & font
let codeInputField = CodeInputField(segments: (0..<6).map { _ in
let segment = CodeInputField.DefaultSegment()
segment.cornerRadius = 8
segment.inputFont = .monospacedDigitSystemFont(ofSize: 20, weight: .black)
return segment
})
```
## Author
[Alex Guretzki](mailto:hi@goergisn.de), https://goergisn.de
## License
CodeInputField is available under the MIT license. See the LICENSE file for more info.