A custom view to enter a code usually in cases of authentication.
SwiftUI OtpView/PinView is an independent project with ongoing development and support made possible thanks to your donations.
Integrating the project is simple. All you need to do is follow the below steps
###Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.
Once you have your Swift package set up, adding OtpView as a dependency is as easy as adding it to the dependencies value of your Package.swift.
dependencies: [
.package(url: "https://github.com/mukeshsolanki/otpview-swiftui.git", .upToNextMajor(from: "1.0.0"))
]
Okay seems like you integrated the library in your project but how do you use it? Well its really easy.
Just use the OtpView
where you need to display the view like.
OtpView(activeIndicatorColor: Color.black, inactiveIndicatorColor: Color.gray, length: 4, doSomething: { value in
// Do something with the value input
})
.padding()
That's pretty much it and your all wrapped up.
Maintained by Mukesh Solanki
- Bug reports and pull requests are welcome.
MIT License
Copyright (c) 2018 Mukesh Solanki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.