title: Bringing up the Google Signin Screen in SwiftUI
body: <p>I am playing around with the Google sign in screen and swiftUI, but I keep getting a bunch of messages in my logs that I don't really understand - now the logs I can live with, but the problem I am having is that I can't call the same function multiple times...</p>
  <pre><code>import SwiftUI
  import GoogleSignIn
  
  class GoogleStuff: UIViewController, GIDSignInDelegate, ObservableObject {
      
      var googleSignIn = GIDSignIn.sharedInstance()
      var googleId = &quot;&quot;
      var googleIdToken = &quot;&quot;
      var googleFirstName = &quot;&quot;
      var googleLastName = &quot;&quot;
      var googleEmail = &quot;&quot;
      var googleProfileURL = &quot;&quot;
      
      func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
          
          guard user != nil else {
              print(&quot;Uh oh. The user cancelled the Google login.&quot;)
              return
          }
          
          print(&quot;TOKEN =&gt; \(user.authentication.idToken!)&quot;)
  
          
      }
      
      func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!, withError error: Error!) {
          
          guard user != nil else {
              print(&quot;Uh oh. The user cancelled the Google login.&quot;)
              return
          }
          
          print(&quot;TOKEN =&gt; \(user.authentication.idToken!)&quot;)
          
      }
  }
  
  struct ContentView: View {
      
      let googleSignIn = GIDSignIn.sharedInstance()
      
      @ObservedObject var myGoogle = GoogleStuff()
      
      @State private var signedIn = false
      @State private var buttonLabel = &quot;Google Sign In&quot;
              
      var body: some View {
          VStack {
                               
              Button(action: {
                  self.signedIn.toggle()
                  self.buttonLabel = self.signedIn ? &quot;Google Sign In&quot; : &quot;Google Sign Out&quot;
                  
                  self.googleSignIn?.presentingViewController = UIApplication.shared.windows.last?.rootViewController
                  self.googleSignIn?.clientID = &quot;MY_TOKEN_GOES_HERE&quot; //It is just a playground for now
                  self.googleSignIn?.delegate = self.myGoogle
                  self.googleSignIn?.signIn()
              }) {
                  HStack {
                      Image(&quot;GLogo&quot;)
                          .resizable()
                          .frame(width: 40, height: 40, alignment: .center)
                      Text(buttonLabel)
                      .foregroundColor(.blue)
                      .font(.title)
                      .font(.custom(&quot;Roboto-Thin&quot;, size: 20))
                  }
                  .padding()
                  .border(Color.black, width: 3)
              }
          }
      }
  }
  </code></pre>
  <p>The error messages I am getting are:</p>
  <blockquote>
  <p>2020-01-03 10:25:14.490522+1300 gsignin[34333:10734362] [AXRuntimeCommon] This class 'SwiftUI.AccessibilityNode' is not a known serializable element and returning it as an accessibility element may lead to crashes</p>
  <p>2020-01-03 10:25:14.789926+1300 gsignin[34333:10734511] [AXRuntimeCommon] Unknown client: gsignin</p>
  <p>2020-01-03 10:25:16.539753+1300 gsignin[34333:10734362] Keyboard cannot present view controllers (attempted to present <code>&lt;SFAuthenticationViewController: 0x7f8a8a842200&gt;</code>)</p>
  </blockquote>
  <p><strong>Question 1:</strong> Should I be concerned about this: <code>[AXRuntimeCommon] Unknown client: gsignin</code></p>
  <p><strong>Question 2:</strong> Once I get this messages, the login screen shows up the first time, but not any time after that... <code>Keyboard cannot present view controllers (attempted to present &lt;SFAuthenticationViewController: 0x7f8a8a842200&gt;)</code></p>
  <p><strong>How can I fix these messages? At the moment I am not getting anywhere.</strong></p>
  <p>PS. I don't mind doing some more reading / research, but please be nice - I am new to swift :-D</p>