I have a UIAlert that I use to redirect users to Gmail Firebase login. Now I want to add support for Sign In With Apple. But I read in multiple locations that you have to set up the button this way:
let siwaButton = ASAuthorizationAppleIDButton()
siwaButton.addTarget(self, action: #selector(appleSignInTapped), for: .touchUpInside)
@objc func appleSignInTapped() {
let provider = ASAuthorizationAppleIDProvider()
let request = provider.createRequest()
// request full name and email from the user's Apple ID
request.requestedScopes = [.fullName, .email]
// pass the request to the initializer of the controller
let authController = ASAuthorizationController(authorizationRequests: [request])
// similar to delegate, this will ask the view controller
// which window to present the ASAuthorizationController
authController.presentationContextProvider = self
// delegate functions will be called when user data is
// successfully retrieved or error occured
authController.delegate = self
// show the Sign-in with Apple dialog
authController.performRequests()
}
Would it be possible to add this button to the following UIAlertView? If not, is there a pod out there that makes it easy to present a menu of sign options?
let preSignInAlert = UIAlertController(title: "Discussions", message: preLoginInfoMessage, preferredStyle: .alert)
let dismissAction = UIAlertAction(title: "Okay", style: .cancel) { _ in }
let loginAction = UIAlertAction(title: "Login", style: .default) { (alert) in
GIDSignIn.sharedInstance()?.signIn()
}
// Space for a third Apple Login button
preSignInAlert.addAction(dismissAction)
preSignInAlert.addAction(loginAction)
present(preSignInAlert, animated: true, completion: nil)
question from:
https://stackoverflow.com/questions/65862589/is-it-possible-to-add-asauthorizationappleidbutton-as-a-uialertaction 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…