title: (Swift) How to retrieve array -> mapped object data from Firestore Cloud
body: <p>I am trying to fetch data from my database but I am having issues with one particular field structure.</p>
  <p>The field is an array containing maps, with some map objects being arrays. How can I input my getDocument code to retrieve the data in this field?</p>
  <p>Code:</p>
  <pre><code>// Fetch data from database
  func getSlideData() {
      
      // get reference to database
      let db = Firestore.firestore()
      let docRef = db.collection(&quot;users&quot;).document(userInfo.id!)
      
      docRef.getDocument { (document, error) in
          if let document = document, document.exists {
              let array = document.get(&quot;Events&quot;) as? [[String: String]]
              
          }
      }
  }
  </code></pre>
  <p>I want to be able to get the array from Firestore and then access the map objects.</p>
  <p><a href="https://i.stack.imgur.com/FpwQU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FpwQU.png" alt="This is how the field is structured." /></a></p>
  <p>This is how the field is structured in Firestore.</p>