hope this finds you well.
For the past few painful hours, I\'ve been trying to find a way to import the Firebase module into my Swift Playground, inside of my workspace,
(Breaking out from a comment to an answer)
I was able to get around this in two ways. The first thing may be enough, but if not the second should do it.
If that doesn't work...
Firebase/Firestore
as a dependency. My Podfile ended up looking like:target 'FirebasePlaygroundDemo' do
use_frameworks!
pod 'Firebase/Firestore'
end
target 'FirebaseDummy' do
use_frameworks!
pod 'Firebase/Firestore'
end
where FirebaseDummy
was the name of my newly created Framework. Then, in the Playground I had to import FirebaseDummy
as well as FirebaseCore
and FirebaseFirestore
.
Hope that helps, can assist further if not!
With immense gratitude to @ryanwils, I've finally found out how to successfully run the Firebase code in a playground. We do need to create an additional framework for this to work.
These are the steps I've taken to successfully do run code on the playground:
xcodeproj
files.PlaygroundFramework
, as you'll see in the code later below.GoogleService-Info.plist
, like in the photo shown below:import UIKit
import PlaygroundSupport
import PlaygroundFramework // Your new framework name here
import FirebaseCore
import FirebaseFirestore
// ... other modules you need. Remember to build first!
let filePath = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist")!
let options = FirebaseOptions(contentsOfFile: filePath)
FirebaseApp.configure(options: options!)
// Your Firebase queries will work here now!
The steps above allowed me to run code from various pods in my podfile as well. Hope it works for whoever needs it, and thanks once again to @ryanwils!