Cannot find type ‘GIDSignInDelegate’ in scope


I am using GoogleSignIn which I have installed using cocoapods and firebase which I installed using the swift package manager.

This is what my main file looks like:

import FirebaseCore
import SwiftUI
import UIKit
import Firebase
import GoogleSignIn 

class AppDelegate: NSObject, UIApplicationDelegate, GIDSignInDelegate {
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        FirebaseApp.configure()
        GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID
        GIDSignIn.sharedInstance().delegate = self // Set the delegate to self

        return true
    }

    // MARK: - GIDSignInDelegate

    func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
        if let error = error {
            // Handle sign-in error
            print("Google Sign-In error: \(error.localizedDescription)")
        } else {
            // Perform any operations after successful sign-in
            print("Google Sign-In successful!")
            // You may want to handle the user object or perform other actions here
        }
    }
}

@main
struct CarpoolyApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate

    var body: some Scene {
        WindowGroup {
            LaunchPage()
        }
    }
}

This is how my podfile looks like:

platform :ios, '17.0'
use_frameworks!

target 'Carpooly' do 
  pod 'GoogleSignIn'
end

I have already ran pod install multiple times and have confirmed that googlesignin should be installed.
However, as you see in this screenshot:
enter image description here

The product files are in red and so is the framework file. I also had a GoogleSignIn framework which I deleted but now it is not returning when I run pod install. Any help is much appreciated thank you! Let me know if you need anything else to help solve this error!

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img