Last active
June 4, 2020 20:03
-
-
Save Yoloabdo/912a18dc44235824177b5b05e0c6f588 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| typealias AuthenticationViewSource = UIViewController & AuthServiceDelegate | |
| class UserAuthenticator { | |
| private weak var source: AuthenticationViewSource? | |
| private var service: AuthService? | |
| init(_ viewController: AuthenticationViewSource) { | |
| self.source = viewController | |
| } | |
| func authenticate(_ type: PreferredAuthMethod) { | |
| guard let source = source else { return } | |
| service = type.getService(source: source, delegate: source) | |
| service?.authenticate() | |
| } | |
| func deAuthenticate(type: PreferredAuthMethod) { | |
| guard let source = source else { return } | |
| service = type.getService(source: source, delegate: source) | |
| service?.deAuthenticate() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment