|
1 | | -# PasscodeKit |
| 1 | +## OVERVIEW |
2 | 2 |
|
3 | | -A lightweight and easy-to-use Passcode Kit for iOS. |
| 3 | +PasscodeKit is a lightweight and easy-to-use, in-app Passcode implementation for iOS. |
| 4 | + |
| 5 | +<img src="https://related.chat/passcodekit/01x.png" width="880"> |
| 6 | + |
| 7 | +## INSTALLATION |
| 8 | + |
| 9 | +### CocoaPods: |
| 10 | + |
| 11 | +To use PasscodeKit with [CocoaPods](https://cocoapods.org), specify in your Podfile: |
| 12 | + |
| 13 | +```ruby |
| 14 | +pod 'PasscodeKit' |
| 15 | +``` |
| 16 | + |
| 17 | +### Manually |
| 18 | + |
| 19 | +If you prefer not to use any of the dependency managers, you can integrate `PasscodeKit` into your project manually. Just copy the contents of the `Sources` folder into your Xcode project. |
| 20 | + |
| 21 | +## REQUIREMENTS |
| 22 | + |
| 23 | +- iOS 12.0+ |
| 24 | + |
| 25 | +## QUICKSTART |
| 26 | + |
| 27 | +To activate the PasscodeKit in your codebase, you need to start it right after the app is launched. The best practice to do it in the AppDelegate `didFinishLaunchingWithOptions` method. |
| 28 | + |
| 29 | +```swift |
| 30 | +PasscodeKit.start() |
| 31 | +``` |
| 32 | + |
| 33 | +The following `PasscodeKitDelegate` methods can be used to take actions related to the PasscodeKit user activity. |
| 34 | + |
| 35 | +```swift |
| 36 | +func passcodeCheckedButDisabled() |
| 37 | + |
| 38 | +func passcodeEnteredSuccessfully() |
| 39 | + |
| 40 | +func passcodeMaximumFailedAttempts() |
| 41 | +``` |
| 42 | + |
| 43 | +To enable, disable the passcode functionality, or to change the saved passcode you can use the following methods. |
| 44 | + |
| 45 | +```swift |
| 46 | +PasscodeKit.createPasscode(self) |
| 47 | + |
| 48 | +PasscodeKit.changePasscode(self) |
| 49 | + |
| 50 | +PasscodeKit.removePasscode(self) |
| 51 | +``` |
| 52 | + |
| 53 | +<img src="https://related.chat/passcodekit/02x.png" width="880"> |
| 54 | + |
| 55 | +## CUSTOMIZATION |
| 56 | + |
| 57 | +The following settings are available for customizing the passcode-related user experience. |
| 58 | + |
| 59 | +```swift |
| 60 | +PasscodeKit.passcodeLength = 4 |
| 61 | + |
| 62 | +PasscodeKit.allowedFailedAttempts = 3 |
| 63 | +``` |
| 64 | + |
| 65 | +```swift |
| 66 | +PasscodeKit.textColor = .darkText |
| 67 | +PasscodeKit.backgroundColor = .lightGray |
| 68 | + |
| 69 | +PasscodeKit.failedTextColor = .white |
| 70 | +PasscodeKit.failedBackgroundColor = .systemRed |
| 71 | +``` |
| 72 | + |
| 73 | +```swift |
| 74 | +PasscodeKit.titleEnterPasscode = "Enter Passcode" |
| 75 | +PasscodeKit.titleCreatePasscode = "Create Passcode" |
| 76 | +PasscodeKit.titleChangePasscode = "Change Passcode" |
| 77 | +PasscodeKit.titleRemovePasscode = "Remove Passcode" |
| 78 | + |
| 79 | +PasscodeKit.textEnterPasscode = "Enter your passcode" |
| 80 | +PasscodeKit.textVerifyPasscode = "Verify your passcode" |
| 81 | +PasscodeKit.textEnterOldPasscode = "Enter your old passcode" |
| 82 | +PasscodeKit.textEnterNewPasscode = "Enter your new passcode" |
| 83 | +PasscodeKit.textVerifyNewPasscode = "Verify your new passcode" |
| 84 | +PasscodeKit.textFailedPasscode = "%d Failed Passcode Attempts" |
| 85 | +PasscodeKit.textPasscodeMismatch = "Passcodes did not match. Try again." |
| 86 | +PasscodeKit.textTouchIDAccessReason = "Please use Touch ID to unlock the app" |
| 87 | +``` |
| 88 | + |
| 89 | +<img src="https://related.chat/passcodekit/03x.png" width="880"> |
| 90 | + |
| 91 | +## CONFIGURATION |
| 92 | + |
| 93 | +PasscodeKit supports both TouchID and FaceID. If you're using FaceID, be sure to add the `NSFaceIDUsageDescription` details into your Info.plist file. |
| 94 | + |
| 95 | +## LICENSE |
| 96 | + |
| 97 | +MIT License |
| 98 | + |
| 99 | +Copyright (c) 2021 Related Code |
| 100 | + |
| 101 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 102 | +of this software and associated documentation files (the "Software"), to deal |
| 103 | +in the Software without restriction, including without limitation the rights |
| 104 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 105 | +copies of the Software, and to permit persons to whom the Software is |
| 106 | +furnished to do so, subject to the following conditions: |
| 107 | + |
| 108 | +The above copyright notice and this permission notice shall be included in all |
| 109 | +copies or substantial portions of the Software. |
| 110 | + |
| 111 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 112 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 113 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 114 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 115 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 116 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 117 | +SOFTWARE. |
0 commit comments