Created
May 11, 2017 01:22
-
-
Save davidtucker/2c79cb8c08e69a36f8091dfdbeb4f3f4 to your computer and use it in GitHub Desktop.
Cognito Delegate Implementation in AppDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AppDelegate: AWSCognitoIdentityInteractiveAuthenticationDelegate { | |
func startPasswordAuthentication() -> AWSCognitoIdentityPasswordAuthentication { | |
if(self.navigationController == nil) { | |
self.navigationController = self.window?.rootViewController as? UINavigationController | |
} | |
if(self.loginViewController == nil) { | |
self.loginViewController = self.storyboard?.instantiateViewController(withIdentifier: "LoginViewController") as? LoginViewController | |
} | |
DispatchQueue.main.async { | |
if(self.loginViewController!.isViewLoaded || self.loginViewController!.view.window == nil) { | |
self.navigationController?.present(self.loginViewController!, animated: true, completion: nil) | |
} | |
} | |
return self.loginViewController! | |
} | |
func startNewPasswordRequired() -> AWSCognitoIdentityNewPasswordRequired { | |
if (self.resetPasswordViewController == nil) { | |
self.resetPasswordViewController = self.storyboard?.instantiateViewController(withIdentifier: "ResetPasswordController") as? ResetPasswordViewController | |
} | |
DispatchQueue.main.async { | |
if(self.resetPasswordViewController!.isViewLoaded || self.resetPasswordViewController!.view.window == nil) { | |
self.navigationController?.present(self.resetPasswordViewController!, animated: true, completion: nil) | |
} | |
} | |
return self.resetPasswordViewController! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment