账号管理 WAAccountStore
- 授权协议: MIT
- 开发语言: Objective-C Swift
- 操作系统: iOS
- 软件首页: https://github.com/YuAo/WAAccountStore
软件介绍
WAAccountStore 是一个简单并且可扩展的账号系统。它封装了基本的账号管理函数,帐户凭据的安全存储,允许你存储任何关于账号的有用信息。
使用示例:
使用你 App 的默认存储
WAAccountStore.defaultStore()
或许你想直接使用 WAAccountStore 。不过,WAAccountCredential 和 WAAccount 创建一些简单的扩展可以让你的工作更轻松。
例如:
将你的用户模块和 WAAccount 联结
//Assuming `User` is your user model class.
extension WAAccount {
var user: User {
get {
return self.userInfo as! User
}
}
convenience init(identifier: String, credential: WAAccountCredential, user: User) {
self.init(identifier: identifier, credential: credential, userInfo: user)
}
}直接进入 不太方便,所以先创建一个方便进入的扩展。WAAccountCredential 的 securityStorage
let UserAccessTokenStorageKey = "AccessToken"
extension WAAccountCredential {
var accessToken: String {
get {
return self.securityStorage[UserAccessTokenStorageKey] as! String
}
}
convenience init(identifier: String, accessToken: String) {
self.init(identifier: identifier, securityStorage: [UserAccessTokenStorageKey: accessToken])
}
}Algorithms + Data Structures = Programs
Niklaus Wirth / Prentice Hall / 1975-11-11 / GBP 84.95
It might seem completely dated with all its examples written in the now outmoded Pascal programming language (well, unless you are one of those Delphi zealot trying to resist to the Java/.NET dominanc......一起来看看 《Algorithms + Data Structures = Programs》 这本书的介绍吧!
