I am making an app that requests data from the Gmail API on iOS using SwiftUI. I was wondering if there is a way to combine the two aforementioned steps into open. Currently, iOS asks the user to open up a signing window, the user signs in, and then iOS asks the user to sign in with and alert again. This is not good UI and I'm hoping, though I'm a beginner, that I can do better!
GIDSignIn.sharedInstance.signIn(with: signinConfig, presenting: (UIApplication.shared.windows.last?.rootViewController)!) { giduser, err in
GIDSignIn.sharedInstance.addScopes(["https://www.googleapis.com/auth/gmail.compose"], presenting: (UIApplication.shared.windows.last?.rootViewController)!) { user, error in
if let user = user {
self.googleUser = user
self.signedIn = true
} else if let error = error {
print(error)
} else {
print("Error")
}
}
}