0

Hi I have been struggling with data structure in my app. I was initially trying to structure it as: parent: node: data node: data:

But I was unable to build this for some reason. So I extended to 2 databases, 1 for user data, and 1 for storing other data about the user.

Problem is I can't seem to get Swift to recognise the 2nd DB and write data to it. Here is my code, id appreciate any input as to what Im doing wrong.

func sendUID() {
    let uid = Auth.auth().currentUser?.uid
    // Get a secondary database instance by URL
    var db2: DatabaseReference!
        db2 = Database.database(url: "https://flight-userid.firebaseio.com/").reference()
        db2.child("users").child(uid!)
}
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
James
  • 19
  • 1
  • 7
  • 2
    The code you shared does not write to the database. Please have a look at [basic write operations](https://firebase.google.com/docs/database/ios/read-and-write#basic_write) in the Firebase documentation to learn how to write. – Frank van Puffelen Jun 29 '18 at 04:16
  • Oh darn how did I not see that. Many thanks – James Jun 29 '18 at 12:26

0 Answers0