title: Firebase snapshot to label in Swift
body: <p>I'm new to Firebase, but learning quickly. This question has eluded me, though, and I've spent the past three days looking for an answer, and I'm sure it's a simple solution that I'm just overlooking. I want to return a value from my Firebase database to populate a label as well as to use for calculations in subsequent views.</p>
  
  <p>I can print the snapshot in the console, but when I assign it to a text label, the label is blank. Just to be clear, I don't want to populate a table with this data. I want to pull specific data from the database and show it in a label and also use it for making calculations.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>@IBOutlet weak var textLabel: UILabel!
  
  let ref = FIRDatabase.database().reference()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      getIncome()
  }
  
  func getIncome() {
      ref.child("Users").child("Family1").child("Income").observeSingleEvent(of: .value, with: { snapshot in
  
          print(snapshot)     // replace this with textLabel or other item
          let m = snapshot.value as? String
          self.textLabel.text = m
      })
  }
  </code></pre>
  
  <p>And here's my JSON tree from Firebase:</p>
  
  <p><img src="https://i.stack.imgur.com/33PGb.png" alt="Screenshot of Firebase Database Structure"></p>