WAAccountStore 1.3

WAAccountStore 1.3

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Feb 2016

Maintained by YuAo.

Depends on:
WAKeyValuePersistenceStore>= 0
UICKeyChainStore>= 0

  • By
  • YuAo

WAAccountStore is a simple yet extensible account system.

It encapsulates the basic account management functions, the security storage of the account credential. And allows you to store any useful information you want with a account.


WAAccount represents a user account. It contains a WAAccountCredential for storing account credential info and a user info object for storing additional info.

WAAccountCredential provides a secure way of storing account credentials. It has a securityStorage property. Anything in the securityStorage will be stored safely in the keychain.

WAAccountStore provides a set of account management functions, such as add account, remove account, update account, etc. As well as notifications for account change (WAAccountStoreCurrentAccountDidChangeNotification, WAAccountStoreCurrentAccountUpdatedNotification)


Use the default store throughout your app.


You may start using WAAccountStore directly. However creating some simple extensions for WAAccountCredential and WAAccount will make your life easier.

For example:

Associate your user model with 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)

Direct access to securityStorage of WAAccountCredential is inconvenient. Create a extension for convenient access.

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])


There's a simple demo project in WAAccountStoreDemo folder. A pod install is required to open and build WAAccountStoreDemo.xcworkspace


Either clone the repo and manually add the files in WAAccountStore directory

or if you use Cocoapods, add the following to your Podfile

pod 'WAAccountStore'


WAAccountStore makes use of WAKeyValuePersistenceStore and UICKeyChainStore


  • Automatic Reference Counting (ARC)
  • iOS 7.0+
  • Xcode 6.3+