Learn Courses My Dashboard

Cannot find 'Firestore' in scope

This is the error that I am receiving. I cannot resolve it. any help?

@ali_ahmad36

Welcome to the Code Crew community.

Have you installed the Firebase frameworks via cocoapods or Swift Package Manager?

Can you show a screenshot of the code where the error is ocurring?

Hi Chris,

I have installed the Firebase via cocoapods.

Pod version is: 1.11.2

XCode version is: 13.2.1

OS: MacOS Monterey 12.1

Pods installed: Firebase/Analytics, Firebase/Auth & Firebase/Firestore.

I’d highly recommend using swift package manager instead, it’s easier

But if you want to keep Cocoapods, try to clean the build folder (Cmd +Shift + K) and build again

Did you see in the Firebase console that your app connected to Firebase?

Cleaning the build folder didn’t help. I would want to try the swift package manager. Is there any link that guides me through the steps?

If you intend to make use of Swift Package Manager (SPM) then you need to de-integrate pods from your project prior to adding the Firebase libraries via SPM.

Open Terminal
Navigate to your project folder
Use the command pod deintegrate
Exit Terminal
In Finder delete the .xcworkspace, Podfile and Podfile.lock files (if they still exist).

This explanation from Apple shows you how to add dependencies via Swift Package Manager.
https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app

The Firebase documentation also provides you with the url for the Firebase SDK Swift Package
https://firebase.google.com/docs/ios/setup

Just a side note. It is very important for you as a developer to gain good search skills so that you can find answers online.

1 Like