title: Update child values in Firebase with Swift
body: <p>I am trying to implement updating Firebase database once a user taps on a button. When the user logs in (with Facebook in my case), a data structure is created successfully with the initial values in the data tree created. </p>
  
  <p>What I want to accomplish is once the user is in the app and they create a new item it saves it to the database, hence updates the values under one of the already created child values. See my code and screenshot for reference - thanks for any help!</p>
  
  <pre><code>// user taps button to send item to be updated in Firebase data tree
  func confirmAddPlace() {
  
      // add place to tableview array
      let accessToken = FBSDKAccessToken.current()
      guard let accessTokenString = accessToken?.tokenString else { return }
  
      let credentials = FIRFacebookAuthProvider.credential(withAccessToken: accessTokenString)
      FIRAuth.auth()?.signIn(with: credentials, completion: { (user, error) in
          if error != nil {
              print("Something went wrong with our FB user: ", error ?? "")
              return
          }
  
      guard let uid = user?.uid else {
          return
      }
      // here is where i am having issues
      let ref = FIRDatabase.database().reference().root.child("Users").child(uid).child("Places")
      let values = ["place": self.placeNameLabel.text]
      ref.updateChildValues(values)
  })
  
      animateOut()
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/GXHJi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GXHJi.png" alt="enter image description here"></a></p>
  
  <pre><code>func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {
          let placeID = place.placeID
          placesClient.lookUpPlaceID(placeID, callback: { (place, error) -&gt; Void in
              if let error = error {
                  print("lookup place id query error: \(error.localizedDescription)")
                  return
              }
              guard let place = place else {
                  return
              }
          })
          let selectedPlace = place.formattedAddress
          if let name = selectedPlace as String!
          {
              self.placeNameLabel.text = "Are you sure you would like to add \(name) to your places?"
          }
      }
  </code></pre>