BeatChain is a manager for saving and retrieving string values into keychain written in swift.
- iOS 10.0+
- Swift 4.0+
- Xcode 10.0+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
to integrate BeatChain into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'BeatChain', '~> 1.0.0'
end
then, run the following command, this will fetch and install the BeatChain pod:
$ pod install
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew install carthage
to integrate BeatChain into your Xcode project using Carthage, specify it in your Cartfile
:
github "beatlabs/BeatChain" "master"
Run carthage update
to build the framework and drag the built BeatChain.framework
into your Xcode project.
You can use The Swift Package Manager to install BeatChain
by adding the proper description to your Package.swift
file:
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "YOUR_PROJECT_NAME",
dependencies: [
.package(url: "https://github.com/beatlabs/BeatChain.git", from: "1.0.0"),
]
)
then, run the following command:
$ swift build
If you prefer you can build the framework manually and drag generated framework BeatChain.framework
into your Xcode project.
import BeatChain
let keychainManager = KeychainManager()
// save password into keychain
do {
let item = GenericPasswordItem(account: "username", accessGroup: "accessGroup")
try keychainManager.saveValue(password, to: item)
} catch {
assertionFailure("Save password failed")
}
// read password from keychain
do {
let item = GenericPasswordItem(account: "account", accessGroup: "accessGroup")
return try keychainManager.readValue(item)
} catch KeychainManagerError.noItemFound {
assertionFailure("Item not found")
} catch {
assertionFailure("Get password failed")
}
// delete password item from keychain
do {
let item = GenericPasswordItem(account: nil, accessGroup: "accessGroup")
try keychainManager.deleteItem(item)
} catch {
assertionFailure("Delete password failed")
}
Install Jazzy
$ gem install jazzy
then you can generate documentation by using the following command:
$ jazzy --min-acl internal
BeatChain is released under the Apache License Version 2.0. See LICENSE for details.
The iOS BEAT team