Cannot find Firestore in scope


I am trying to get through the lessons on iOS databases and having a terrible time.

I installed Firebase with Swift Packager Manager. I’ve created a few collections and documents via the web.

I followed the Google instructions to get firebase in my app which are considerably different than the video. It doesn’t use init configure.
It’s calls AppDelegate: NSObject, UIApplicationDelegate{
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = FirebaseApp.configure()
return true}}

I do have my plist downloaded and added to xcode.

Then inside the app struct there’s
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate

Now I’m on lesson 5 and trying to create the first function but Firestore.firestore() results in a "Cannot find ‘Firestone’ in scope.

I tried removing all the code above that Google gave me and just use the init configure but that didn’t resolve the error.

I have zero clue what I’m doing (which is why I’m taking lessons). Since the video doesn’t have any information on installing Firestore using SPM I have no idea what packages or package dependencies I should have selected when installing Firebase via SPM–Google doesn’t cover it and the video doesn’t even have an “here’s an alternate method” in the text below.

I don’t now if I’m missing something in the install or if my syntax is wrong or what is going on.


I would be happy to have a look at your code if you would be prepared to share your Application via DropBox or Google Drive. If so, can you compress the entire project into a zip file and share that zip file via either of the above.

To compress the project, locate the project folder in Finder and then right click on the top level folder and select Compress ProjectName. The top level folder is the one that contains the file named ProjectName.xcodeproj and the folder named ProjectName.

Upload that zip file to either Dropbox or Google Drive and then create a share link then copy that link and paste that in a reply to this thread.

If you choose to use Google Drive then when you create the Share link, ensure that the “General Access” option is set to “Anyone with the Link” rather than “Restricted”.

@Chris_Parker thank you!

Here is a Google Drive link: Firebase - Google Drive


I followed this course a long time ago (April 2021) and at that time it was created using cocoapods to install the Firebase frameworks. SPM, as you have discovered, is now the preferred method since it is simpler once you get the hang of it.

For this course you only needed to select these two framework options from the Package Manager window

I have made some changes to your project so that it now should work. There is no need to have an AppDelegate instance in the project as a means of initialising Firebase. The init method that was described in the course is perfectly sufficient to achieve that task.

Instead of using import FirebaseCore all you needed was import Firebase

Here is a link to your updated code:

I moved the function you had created - makeReservation - to ContentView and created a Button to call that function.

Each time the course covers a particular aspect of creating a record, it’s easier to create a new function to do that as a means of keeping a record of what you did previously. It also gets you used to writing similar code which helps you remember what to do. When you want to run that new function, just change the code in the button action to call it.

Thank you! I appreciate both the updated code and the explanation :smile: