in authentication/AuthenticationExample/ViewControllers/AccountLinkingViewController.swift [65:107]
func didSelectRowAt(_ indexPath: IndexPath, on tableView: UITableView) {
let item = dataSourceProvider.item(at: indexPath)
let providerName = item.title!
guard let provider = AuthProvider(rawValue: providerName) else {
// The row tapped has no affiliated action.
return
}
// If the item's affiliated provider is currently linked with the user,
// unlink the provider from the user's account.
if item.isChecked {
unlinkFromProvider(provider.id)
return
}
switch provider {
case .google:
performGoogleAccountLink()
case .apple:
performAppleAccountLink()
case .facebook:
performFacebookAccountLink()
case .twitter, .microsoft, .gitHub, .yahoo:
performOAuthAccountLink(for: provider)
case .emailPassword:
performEmailPasswordAccountLink()
case .passwordless:
performPasswordlessAccountLink()
case .phoneNumber:
performPhoneNumberAccountLink()
default:
break
}
}