Skip to content

Instantly share code, notes, and snippets.

@wf-adamhei
Created July 30, 2021 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wf-adamhei/4b88ec80b7e00a4bc2d5ccc28ef040ac to your computer and use it in GitHub Desktop.
Save wf-adamhei/4b88ec80b7e00a4bc2d5ccc28ef040ac to your computer and use it in GitHub Desktop.
@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