title: Access a child key:value for a user in Firebase - Swift
body: <p>I have a user with they typical Name and Email Fields. There is another field that has a child with another user's UID and Bool Value.</p>
  
  <p>I would like to access that user UID.</p>
  
  <p>Database<p>
  --Firstname<p>
  --Lastname<p>
  --studentSession1List<p>
  ----UID:True</p>
  
  <pre><code>struct User {
  
  
  var uid: String
  var firstName: String
  var lastName: String
  var email: String?
  var password: String?
  var username: String?
  var pushToken: String?
  var studentSession1List: [String: Any]?
  var studentSession2List: [String: Any]?
  var hasUsername: Bool = false
  
  init(uid: String, dictionary: [String: Any]) {
  
      self.uid = uid
      self.firstName = dictionary["firstName"] as? String ?? ""
      self.lastName = dictionary["lastName"] as? String ?? ""
      self.email = dictionary["email"] as? String ?? ""
      self.password = dictionary["password"] as? String ?? ""
      self.username = dictionary["username"] as? String ?? ""
      self.pushToken = dictionary["pushToken"] as? String ?? ""
      self.studentSession1List = dictionary["studentSession1List"] as? [String: Any] ?? ""
      self.studentSession2List = dictionary["studentSession2List"] as? [String: Any] ?? ""
  }}
  
  var filteredUsers = [User]()
  var users = [User]()
  fileprivate func fetchUsers() {
  
      let ref = Database.database().reference().child("studentUsers")
      ref.observeSingleEvent(of: .value, with: {(snapshot) in
  
          guard let dictionaries = snapshot.value as? [String: Any] else { return }
  
          dictionaries.forEach({ (key, value) in
  
              if key == Auth.auth().currentUser?.uid {
                  return
              }
  
              guard let userDictionary = value as? [String : Any] else { return }
  
              let user = User(uid: key, dictionary: userDictionary)
              self.users.append(user)
  
  
          })
  
          self.users.sort(by: { (u1, u2) -&gt; Bool in
  
              return u1.lastName.compare(u2.lastName) == .orderedAscending
          })
  
          self.filteredUsers = self.users
          self.collectionView?.reloadData()
          print(self.filteredUsers)
  
      }) { (err) in
          print("Failed to fetch users in search", err)
      }
  }
  </code></pre>
  
  <p>My user array is giving me a no UID:True key:values for the studentSession1List.</p>