Как я могу проверить вход в аккаунт Google в моём приложении? (How can I verify my Google account login in my app?) Swift 5
import GoogleSignIn
// 1
override func viewDidLoad() {
super.viewDidLoad()
if GIDSignIn.sharedInstance.
hasPreviousSignIn() {
print("You are logged in to your account")
navigationController?.pushViewController(ViewController2(),
animated: true)
}
else {
print("You are not logged in to your account")
}
}
// 2
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
GIDSignIn.sharedInstance.restorePreviousSignIn { user, error in
if error != nil || user == nil {
print("You are not logged in to your account")
} else {
print("You are logged in to your account")
}
}
return true
}
Возврат к списку