Google Sign-In Scope Error

Hello all,

I'm currently trying out the Google Sign-In (using firebase) feature for the first time - I'm following a tutorial, that's why you can see a few 'pointers' near the end of the code - and I have been greeted with an error: "Cannot find 'view' in scope" on line 48. I'd really appreciate it if someone could solve this, thanks!

import GoogleSignIn
import Firebase
import FirebaseAuth

struct LoginScreen: View {
    @State var username: String = ""
    @State var password: String = ""
    
    var body: some View {
        VStack {
            VStack {
                LoginHeader()
                    .padding(.bottom)
                
                CustomTextfield(text: $username)
                
                CustomTextfield(text: $username)
                
                HStack {
                    Spacer()
                    Button(action: {}) {
                        Text("Forgot Password?")
                    }
                }
                .padding(.trailing, 24)
                
                CustomButton()
                
                
                Text("or")
                    .padding()
                
                GoogleSiginBtn {
                    guard let clientID = FirebaseApp.app()?.options.clientID else { return }
                            
                    let config = GIDConfiguration(clientID: clientID)

                  GIDSignIn.sharedInstance.configuration = config
                            
                    GIDSignIn.sharedInstance.signIn(withPresenting:   view.getRootViewController()) { signResult, error in
                                
                        if let error = error {
                            ...{ return }
                        }
                                
                         guard let user = signResult?.user,
                               let idToken = user.idToken else { return }
                         
                         let accessToken = user.accessToken
                                
                         let credential = GoogleAuthProvider.credential(withIDToken: idToken.tokenString, accessToken: accessToken.tokenString)

                        // Use the credential to authenticate with Firebase
                        Auth.auth().signIn(with: credential) { authResult, error in

                        }
                        
                    }

                    
                } // GoogleSiginBtn
            } // VStack
            .padding(.top, 52)
            Spacer()
        }
    }
}
struct LoginScreen_Previews: PreviewProvider {
    static var previews: some View {
        LoginScreen()
    }
}
Post not yet marked as solved Up vote post of DanGL Down vote post of DanGL
489 views