https://github.com/romankovalchukdev/nerdzpinview
NerdzPinView is a highly customisable library used for entering pin and one time codes.
https://github.com/romankovalchukdev/nerdzpinview
otp otp-verification otpview passcode swift swiftui view-component
Last synced: 2 months ago
JSON representation
NerdzPinView is a highly customisable library used for entering pin and one time codes.
- Host: GitHub
- URL: https://github.com/romankovalchukdev/nerdzpinview
- Owner: RomanKovalchukDev
- License: mit
- Created: 2024-11-20T18:26:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-19T14:07:53.000Z (11 months ago)
- Last Synced: 2025-02-26T23:14:35.773Z (11 months ago)
- Topics: otp, otp-verification, otpview, passcode, swift, swiftui, view-component
- Language: Swift
- Homepage:
- Size: 111 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# NerdzPinView
NerdzPinView is a highly customisable library used for entering pin and one time codes.
[](https://developer.apple.com/swift/)
[](https://www.swift.org/documentation/package-manager/)
[](http://www.apple.com/ios/)
[](https://opensource.org/licenses/MIT)
## Getting Started
NerdzPinView library supports both UIKIt and SwiftUI frameworks.
## Installation
### Swift Package Manager
To add NerdzPinView to a Swift Package Manager based project add it using Xcode add package command or add it as a dependency inside your `Package.swift` file:
```.package(url: "https://github.com/RomanKovalchukDev/NerdzPinView")```
### Manual
Clone the repo and drag files from `NerdzPinView/Sources` folder into your Xcode project.
## Usage
### SwiftUI
NerdzPinView library provides complete SwiftUI wrapper over custom UIKeyInput component. To use it inside your SwiftUI application just add `NerdzBorderedPinView` or `NerdzUnderlinePinView` inside your view body.
SwiftUI views have `text`, `viewState`, and `isFocused` binding properties alongside UIKeyInput properties that are passed to the wrapped view.
You could take a look into the usage of the library inside SwiftUI project using [SwiftUI demo project](https://github.com/RomanKovalchukDev/NerdzPinView/tree/main/Samples/NerdzPinSwiftUISample).
### UIKit
To use the library from the xib files or storyboards you should use `DesignableBorderedPinInputView` or `DesignableUnderlinedPinInputView` - this two classes are predefined views that are wrapers around generic `PinCodeInputView`.
You could also use generic `PinCodeInputView` programatically. This use case mostly needed for you to provide your own item display view.
You could take a look into the usage of the library inside SwiftUI project using [SwiftUI demo project](https://github.com/RomanKovalchukDev/NerdzPinView/tree/main/Samples//NerdzPinUIKitSample).
## Requirements
- iOS 16.0 +
- Xcode 16.0 +
## License
NerdzPinView is available under the MIT license. See LICENSE for details.