Preview:
ref.child("users").child("userId").observe(.value) { (snapshot) in
  if let value = snapshot.value as? [String: Any] {
    let name = value["name"] as? String ?? ""
    let age = value["age"] as? Int ?? 0
    print("Name: \(name), Age: \(age)")
  }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter