HYKeychainHelper is an iOS tool for Keychain operations. You can easily obtain an account, obtain a password, add a password, and delete a password.
requirements
- Swift 3
- IOS 10.0 +
- Xcode 8+
CocoaPods is the most commonly used dependency management tool for iOS. You can install it using the following command:
$ gem install cocoapodsCopy the code
Then create a Podfile in the project root directory and write the following:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios.'10.0'
use_frameworks!
pod 'HYKeychainHelper'Copy the code
Finally, run the following command from the command line to complete the installation:
$ pod installCopy the code
Manual installation
Download the project file and drag the /HYKeychainHelper folder into your project.
HYKeychainHelper works similarly to SSKeychain, so it’s easy to get started. To test the Keychain functionality, I provided a simple Demo. You can change the bundle ID to your own. In addition, you need to enable Keychain support. If there are other problems, you can submit an issue, and I will reply immediately.
usage
HYKeychainHelper is simple to use; all external methods are provided as class methods. Details are as follows:
/// query account's password
HYKeychainHelper.password(service: "your_service_name".account: "your_account_name")
/// add or update an account
HYKeychainHelper.set(password: "your_password".service: "your_service_name".account: "your_account_name")
/// delete an account
HYKeychainHelper.deletePassword(service: "your_service_name".account: "your_account_name")
/// all accounts
HYKeychainHelper.allAccounts(forService: "your_service_name")Copy the code
For more usage, see HYKeychainHelper for more details.
HYKeychainHelper was developed with Swift 3, so your Swift version must be Swift 3.
communication
- If you have a problem or need help, you can create an issue and I will answer it for you in the first time.
- If you need some optimization, create an issue discussion;
- If you want to submit a contribution, publish a pull Request.
HYKeychainHelper is available under the MIT license. See the LICENSE file for more info.