Skip to content

Instantly share code, notes, and snippets.

@wf-adamhei
Created July 30, 2021 03:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
private let WFAccessGroupKey: String = "WFAccessGroup"
private let WFCredentialHelperServiceKey: String = "WFCredentialHelperServiceName"
private let AccessPropertiesPlistName: String = "KeychainAccessGroupBridge-Dev"
private let TestAccountUsernameKey = "TestAccountUsernameKey"
private let TestAccountPasswordKey = "TestAccountUsernameKey"
private lazy var keychainWrapper: KeychainWrapper = {
guard let accessPropertiesUrl = Bundle.main.url(forResource: AccessPropertiesPlistName, withExtension: "plist"),
let keychainAccessProperties = NSDictionary(contentsOf: accessPropertiesUrl),
let keychainServiceName = keychainAccessProperties[WFCredentialHelperServiceKey] as? String,
let keychainAccessGroup = keychainAccessProperties[WFAccessGroupKey] as? String else {
fatalError("Unable to read contents of KeychainAccessGroupBridge-Dev.plist")
}
return KeychainWrapper(serviceName: keychainServiceName,
accessGroup: keychainAccessGroup)
}()
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let args = CommandLine.arguments
let username = args[1]
let password = args[2]
keychainWrapper.set(username, forKey: TestAccountUsernameKey)
keychainWrapper.set(password, forKey: TestAccountPasswordKey)
exit(EXIT_SUCCESS)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment