Keeping Simple-KeychainSwift up-to-date is a time consuming task. Making updates, reviewing pull requests, responding to issues and answering emails all take time. If you'd like to help keep me motivated, please download my free app, Photo Flipper from the App Store. (To really motivate me, pay $1.99 for the IAP ๐)
And don't forget to โ the repo. This increases its visibility and encourages others to contribute.
Thanks Ash
To run the example project, clone the repo, and run pod install
from the Example directory first.
Just drop the Keychain.swift file into your project. That's it!
Simple-KeychainSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Simple-KeychainSwift"
Simple-KeychainSwift was wrtten by Ashley Mills, [email protected]
Simple-KeychainSwift is available under the MIT license. See the LICENSE file for more info.
Simple-KeychainSwift declares a protocol TypeSafeKeychainValue
:
public protocol TypeSafeKeychainValue {
func data() -> Data? // Convert to Data
static func value(data: Data) -> Self? // Convert from Data
}
You can use Simple-KeychainSwift to set any types that conform to this protocol. Currently supported are String
, Int
, Bool
and Date
, To set other types, add conformity to TypeSafeKeychainValue
, e.g.
extension Int: TypeSafeKeychainValue {
public func data() -> Data? {
var value = self
return Data(bytes: &value, count: MemoryLayout.size(ofValue: value))
}
public static func value(data: Data) -> Int? {
return data.withUnsafeBytes { $0.pointee }
}
}
Keychain.set("some value", forKey: "some string")
Keychain.set(true, forKey: "some bool")
Keychain.set(Date(), forKey: "some date")
Keychain.set(27, forKey: "some int")
Keychain.value(forKey: "some string") as String
Keychain.value(forKey: "some bool") as Bool
Keychain.value(forKey: "some date") as Date
Keychain.value(forKey: "some int") as Int
Keychain.removeValue(forKey: "my key")
Keychain.reset()
Got a bug fix, or a new feature? Create a pull request and go for it!
If you use Simple-KeychainSwift, please let me know.
Cheers, Ash
keychain.swift's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.