-
Notifications
You must be signed in to change notification settings - Fork 344
Using KeychainSwift in Objective C project
Evgenii Neumerzhitckii edited this page Jan 21, 2017
·
4 revisions
This is how to use KeychainSwift in Objective-C apps.
- Add KeychainSwiftCBridge.swift to your project and extend it to suit your needs.
- Import swift code in your Objective-C file:
#import "YOUR_PRODUCT_MODULE_NAME-Swift.h"
- Use KeychainSwift in your ObjC code:
- (void)viewDidLoad {
[super viewDidLoad];
KeychainSwiftCBridge *keychain = [[KeychainSwiftCBridge alloc] init];
[keychain set:@"Hello World" forKey:@"my key"];
NSString *value = [keychain get:@"my key"];
}
Note: You might need to remove import KeychainSwift
from KeychainSwiftCBridge.swift
file in your project.