title: My database values for the detected QR are not changing
body: <p>I’m designing a QR scanner application that reads the generated QR from another application and change its value. The application works correctly and it scans the QR's where the metaDataObj.stringValue is the value of the QR detected. the problem is when i try to change the child value on firebase it doesn’t change. What's wrong with the code?
  Attached picture of my database
  <img src="https://i.stack.imgur.com/fVXfn.png" alt="Database Picture" /></p>
  <pre><code>if metadataObj.stringValue != nil {
      messageLabel.text = metadataObj.stringValue
      let QRnumber = metadataObj.stringValue ?? &quot;&quot;
      let QRname = ref.child(&quot;QRCode&quot;)
      QRname.observe(.childAdded, with: { [self] snapshot in
         let detected = snapshot.value as? Int
         if detected == Int(QRnumber){
         snapshot.setValue(true, forKey: &quot;isScanned&quot;)
             self.messageLabel.text = &quot;successfuly scanned&quot;
         }
         else{
             messageLabel.text = &quot;not valid QR&quot;
  
         }
  }
  </code></pre>