title: Firebase remove snapshot children swift
body: <p>I am using <code>Firebase</code> as my Database...
  <a href="https://i.stack.imgur.com/XNV7q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XNV7q.png" alt="enter image description here"></a></p>
  
  <p>Then i want to delete the <code>"codigo"</code> key value. This is my if statement:</p>
  
  <pre><code>let profile = FIRDatabase.database().reference().child("barcodes")
           profile.observeEventType(.Value, withBlock: { (snapshot) -&gt; Void in
  
  
              for item in snapshot.children {
  
                  if item.value["codigo"]as! String == barcodes[indexPath.row].code{
                      print("HERE")
  
                  item.removeValue!()
  
  
                  }
  
  
              }
  </code></pre>
  
  <p>but it crashes at <code>item.removeValue()</code>. </p>