Swiftpack.co - goergisn/CodeInputField as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by goergisn.
goergisn/CodeInputField 1.0.2
An input field allowing the user to enter digits
⭐️ 1
🕓 3 years ago
iOS
.package(url: "https://github.com/goergisn/CodeInputField.git", from: "1.0.2")

CodeInputField

An input field allowing the user to enter digits

Swift Package Manager

Usage

Obfuscated Code Input Preview

// 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)

Code Input Preview

// 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, https://goergisn.de

License

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

GitHub

link
Stars: 1
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

CodeInputField v1.0.2 - Update
3 years ago
  • exposed numberOfDigits to check if input is complete when listening to the .editingChanged event
  • exposed clearInput()
  • added more documentation

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics