2012年12月31日月曜日

Keychain API ラッパー



@interface FXKeychain : NSObject

+ (instancetype)defaultKeychain;

@property (nonatomic, copy, readonly) NSString *account;
@property (nonatomic, copy, readonly) NSString *service;
@property (nonatomic, copy, readonly) NSString *accessGroup;

- (id)initWithAccount:(NSString *)account
              service:(NSString *)service
          accessGroup:(NSString *)accessGroup;

- (BOOL)setObject:(id)object forKey:(id)key;
- (BOOL)setObject:(id)object forKeyedSubscript:(id)key;
- (BOOL)removeObjectForKey:(id)key;
- (id)objectForKey:(id)key;
- (id)objectForKeyedSubscript:(id)key;

@end

シンプルでなかなかいい。Subscripting対応なので keychain[@"key"]=obj や obj=keychain[@"Key1"]みたいな書き方ができる(たぶん)。

参考)

0 件のコメント:

コメントを投稿