title: Swift Firebase - Convert database snapshot into an array
body: <p>I have a groups reference in firebase that looks like this:
  <a href="https://i.stack.imgur.com/LD6NY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LD6NY.png" alt="database"></a></p>
  
  <p>I'm having trouble converting the list of members into an array of strings in my app.</p>
  
  <p>I'm fetching the data like so:</p>
  
  <pre class="lang-swift prettyprint-override"><code>//Reference to each group
  let ref = Database.database().reference().child("groups").child(snapshot.key)
  
  //Get the group data from the reference
  ref.observeSingleEvent(of: .value, with: { (groupSnap) in
      //Cast data as dictionary [String:Any]
      if let dictionary = groupSnap.value as? [String: Any] {
          //Parse each group object
          if let group = Group.parse(snapshot.key, dictionary) {
              groups.insert(group, at: 0)
          }
  
          //Escape with group array
          complete(groups)
      }
  })
  </code></pre>
  
  <p>And currently parsing the data without the members:</p>
  
  <pre class="lang-swift prettyprint-override"><code>static func parse(_ key: String, _ data: [String:Any]) -&gt; Group? {
      let name = data["name"] as! String
      let category = data["category"] as! String
      let owner = data["owner"] as! String
  
      return Group(id: key, name: name, category: Group.Category(rawValue: category)!, ownerId: owner, members: nil)
  }
  </code></pre>
  
  <p>How would I turn the members list into an array of strings for my group object?</p>