You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.6 KiB

  1. # SROTPView
  2. [![CI Status](https://img.shields.io/travis/sarojraut09@gmail.com/SROTPView.svg?style=flat)](https://travis-ci.org/sarojraut09@gmail.com/SROTPView)
  3. [![Version](https://img.shields.io/cocoapods/v/SROTPView.svg?style=flat)](https://cocoapods.org/pods/SROTPView)
  4. [![License](https://img.shields.io/cocoapods/l/SROTPView.svg?style=flat)](https://cocoapods.org/pods/SROTPView)
  5. [![Platform](https://img.shields.io/cocoapods/p/SROTPView.svg?style=flat)](https://cocoapods.org/pods/SROTPView)
  6. ## Example
  7. ![alt text](https://github.com/sarojraut/SROTPView/blob/master/sample.gif)
  8. ![alt text](https://github.com/sarojraut/SROTPView/blob/master/bordered.png)
  9. ![alt text](https://github.com/sarojraut/SROTPView/blob/master/rounded.png)
  10. To run the example project, clone the repo, and run `pod install` from the Example directory first.
  11. ## Requirements
  12. - iOS 10.0+
  13. - Xcode 11
  14. ## Installation
  15. SROTPView is available through [CocoaPods](https://cocoapods.org). To install
  16. it, simply add the following line to your Podfile:
  17. ```ruby
  18. pod 'SROTPView'
  19. ```
  20. #### Carthage
  21. Create a `Cartfile` that lists the framework and run `carthage update`. Follow the [instructions](https://github.com/Carthage/Carthage#if-youre-building-for-ios) to add `$(SRCROOT)/Carthage/Build/iOS/SROTPView.framework` to an iOS project.
  22. ```
  23. github "sarojraut/SROTPView"
  24. ```
  25. #### Manually
  26. 1. Download and drop ```SROTPView.swift and SROTPTextField.swift``` in your project.
  27. 2. Congratulations!
  28. ## Usage example
  29. ```swift
  30. import UIKit
  31. import SROTPView
  32. class ClassThatUseThisLibrary: UIViewController {
  33. @IBOutlet weak var otpView: SROTPView! //dont use SROTPField use SROTPView
  34. override func viewWillAppear(_ animated: Bool) {
  35. super.viewWillAppear(animated)
  36. otpView.otpTextFieldsCount = 6
  37. otpView.otpTextFieldActiveBorderColor = UIColor.white
  38. otpView.otpTextFieldDefaultBorderColor = UIColor.green
  39. otpView.otpTextFieldFontColor = UIColor.green
  40. otpView.activeHeight = 4
  41. otpView.inactiveHeight = 2
  42. otpView.otpType = .Rounded //.Rounded for round
  43. otpView.otpEnteredString = { pin in
  44. print("The entered pin is \(pin)")
  45. }
  46. otpView.setUpOtpView()
  47. }
  48. override func viewDidAppear(_ animated: Bool) {
  49. otpView.initializeUI()
  50. }
  51. }
  52. ```
  53. ## Contribute
  54. We would love you for the contribution to **SROTPView**, check the ``LICENSE`` file for more info.
  55. ## Author
  56. sarojraut09@gmail.com
  57. ## License
  58. SROTPView is available under the MIT license. See the LICENSE file for more info.
  59. Copyright (c) 2019 sarojraut09@gmail.com
  60. Permission is hereby granted, free of charge, to any person obtaining a copy
  61. of this software and associated documentation files (the "Software"), to deal
  62. in the Software without restriction, including without limitation the rights
  63. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  64. copies of the Software, and to permit persons to whom the Software is
  65. furnished to do so, subject to the following conditions:
  66. The above copyright notice and this permission notice shall be included in
  67. all copies or substantial portions of the Software.
  68. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  69. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  70. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  71. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  72. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  73. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  74. THE SOFTWARE.