I am currently creating an app in Xcode using swift where I want to read and write from two different Firebase databases in one Xcode project. I know that this is definitely supported by Firebase, but when I use their documentation I am still finding it hard to set up.
I know there is an answer for this question using Android here: https://stackoverflow.com/a/43215981/9308748
However, I am making my app for IOS.
I have looked at the documentation and followed what it says, but whenever I run the project it tries to get all information I am looking for from the most recently created Firebase database, and not the specific one I am trying to retrieve from. I don't know what code to put in the AppDelegate class and what to put in the viewController classes in order to connect to a specific database.
I have added both GoogleService-info.plist Files into my Xcode project (I don't know if I should do this or not)
This is what I have done so far inside my AppDelegate Class for both of my firebase projects:
let primaryOptions = FirebaseOptions(googleAppID: "My googleAppID", gcmSenderID: "my gcmSender")
primaryOptions.bundleID = "my bundleID"
primaryOptions.apiKey = "my apiKey"
primaryOptions.clientID = "my clientID"
primaryOptions.databaseURL = "my DatabaseURL"
primaryOptions.storageBucket = "my storageBucket"
FirebaseApp.configure(name: "primaryOptions", options: primaryOptions)
guard let primaryApp = FirebaseApp.app(name: "primaryOptions")
else { assert(false, "Could Not retrieve primary app")}
let primaryDB = Database.database(app: primaryApp)
Then after doing this in my AppDelegate Class I don't know how to reference this specific set of information form my view controller classes in order to read and write from the specific database.
Please Help!