FAST LOGIN SDK
Fast Login SDK IOS
The FastLogin IOS SDK is compatible with IOS 9.0 and above. Swift 5.0 and above
1. Installation
Add to your pod file following
pod 'FastLogin', :git => 'https://github.com/Turkcell/FastLogin.git', :branch => 'v2.0'
2. Login Coordinator
Before starting the Login process you should provide following parameters,
-appID: Application id which assigned to each app by FastLogin admin
-language: Language of SDK default is TR
-useTestServer: using Test or Prod servers
-disableCellLogin: if true, cellular login functionality won’t work.
-autoLoginOnly: if true, only cellular login and remember me will work
-disableAutoLogin: if true, login process is forced to user.
-accessGroup: Keychain access group of applications if any,
class ViewController: UIViewController {
// Setup Login Coordinator
var loginCoordinator: DGLoginCoordinator!
private func setupLoginCoordinator() {
loginCoordinator = DGLoginCoordinator(self)
loginCoordinator.appID = "APP_ID"
loginCoordinator.language = "TR"
loginCoordinator.environment = DGEnvironment.test
loginCoordinator.disableCell = false
loginCoordinator.autoLoginOnly = false
loginCoordinator.disableAutoLogin = false
loginCoordinator.coordinatorDelegate = self
}
...
}
Afterwards call start on the coordinator. That's it!
private func start() {
loginCoordinator.start(dgFlow: DGFlow.login)
}
3. Login Coordinator Delegate
Login Coordinator Delegate methods to handle what happens after the user tries to login,
Here you would call your own API.
You can not use LoginCoordinatorDelegate with extension. You should use like this. (Module stability)
class ViewController: UIViewController, LoginCoordinatorDelegate {
func dgLoginToken(_ token: String) {
print("TOKEN \(token)")
}
func dgLoginFailure(_ reason: String, errorMessage: String) {
if reason == dgKSessionTimeout as String {
print(errorMessage)
} else if reason == dgKUserExit as String {
print(errorMessage)
} else if reason == dgKNotLoginToLoginSDK as String {
print(errorMessage)
} else {
print(errorMessage)
}
func dgConfigurationFailure(configError: String) {
}
}
4. Logout
You can call the logout() method to logout from SDK.
private func logOut() {
loginCoordinator.logout()
}
The principles regarding the use of open source codes used in the application can be accessed from the links below:
https://github.com/puretears/KeychainWrapper/blob/master/LICENSEhttps://github.com/puretears/KeychainWrapper/blob/master/LICENSE