title: How to read/write from one IOS App set up with firebase, to another firebase database contained in another firebase project? Swift 3
body: <p>I have a Firebase database connected to my IOS app with the GoogleService-Info.plist. In AppDelegate I configured the App FIRApp.configure(). I could read/write data. </p>
  
  <p>Now, from within this IOS app, I would like to access another FireBase Database <code>brevCustomer</code>. For some reason <code>let dbRef</code> from <code>viewDidLoad</code> has a flag in Xcode saying this 'immutable value <code>dbRef</code> was never used' and the app crashes on the first line in fun startObserving() <code>dbRef.observe(.value, with: { (snapshot: FIRDataSnapshot) in</code>.     </p>
  
  <p>Could anyone show how to do the configuration so that I can read/write to brevCustomer database?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Please consider the following scenario:    </p>
  
  <ul>
  <li><p>I have two IOS apps <em>Customer</em> and <em>Worker</em> and two Firebase Projects named <em>CustomerFireBase</em> and <em>WorkerFirebase</em> and I would like them to work in the following way.</p></li>
  <li><p>Customer registers with email and password, logs in, makes a booking, and data is saved in CustomerFireBase. </p></li>
  <li>Worker registers with email and password, logs is,  observe WorkerFirebase for value changes or child added
  
  <ul>
  <li>read from CustomerFireBase
  
  <ul>
  <li>write to CustomerFireBase</li>
  <li>write to WorkerFirebase</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>How can I achieve this? Basically, I need to get read/write access from one IOS app configured <a href="https://firebase.google.com/docs/ios/setup" rel="nofollow noreferrer">in the usual way</a> with Firebase, to another Firebase Database contained in another Firebase project.</p>
  
  <pre><code>Class Claim {
  
    var dbRef:FIRDatabaseReference! //create a reference to Firebase database `brevCustomer`, not the one from .plist file
  
     override func viewDidLoad() {
         super.viewDidLoad()
  
       let app = FIRApp(named: "brevCustomer")
       let dbRef = FIRDatabase.database(app: app!).reference().child("Users")
       startObservingDB() // observe the database for value changes
      }
  
   func startObservingDB() {
     //it crashes on the line below
      dbRef.observe(.value, with: { (snapshot: FIRDataSnapshot) in
  
          //iterate over each user node child
          for user_child in snapshot.children {
               print(user_child)} 
  
            }, withCancel: { (Error: Any) in
           print(Error)
         })
     } // end of startObservingDB()
  }//end of Claim class
  
  
  
  class AppDelegate: UIResponder, UIApplicationDelegate {
  
  var window: UIWindow?
  
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool {
  
  // Use Firebase library to configure APIs for the initial project with .plist file saved in Xcode
  FIRApp.configure()
  
  
      /** 1. create a Firebase options object to hold the configuration data for the second Firebase Project */
      let secondaryOptions = FIROptions(googleAppID: "1:82424687545:ios:71df5d45218ad27",
                                        bundleID: "com.vivvdaplar.Brev",
                                        gcmSenderID: "8201647545",
                                        apiKey: "AIzaSyCNtyUf2T3UunH6-ci_WyvOqCl_RzXI",
                                        clientID: "8200687545-42vklp94reavi6li6bolhcraoofc6.apps.googleusercontent.com",
                                        trackingID: nil,
                                        androidClientID: nil,
                                        databaseURL: "https://brev-72e10.firebaseio.com",
                                        storageBucket: "com.vivvdaplar.Brev",
                                        deepLinkURLScheme: nil)
  
      // Configure the app
      FIRApp.configure(withName: "brevCustomer", options: secondaryOptions!) 
         return true
    }
  } //end of AppDelegate
  </code></pre>