title: FIRInvalidArgumentException: Nested arrays are not supported
body: <p>Currently, I'm trying to use Swift's codable protocol to add and read custom objects to and from Firebase's database. I've been following the instructions in these <a href="https://firebase.google.com/docs/firestore/manage-data/add-data#custom_objects" rel="nofollow noreferrer">docs</a>. However, when I try to write to the database, I'm getting an error &quot;FIRInvalidArgumentException: Nested arrays are not supported&quot;. But aren't they supported? I saw another post on here from a couple of years ago that addressed a similar issue but I don't understand what I did wrong here.</p>
  <p>These are the Swift struct representations that implement Codable:</p>
  <pre><code>struct List: Codable {
  
      var title: String
      var date: String
      var description: String
      var data: [SectionHeaders: Array&lt;Item&gt;] = [
          .produce: [],
          .seafood: [],
          .meat: [],
          .deli: [],
          .bakery: [],
          .pantry: [],
          .dairy: [],
          .frozen: [],
          .other: []
      ]
      
      enum CodingKeys: String, CodingKey {
          case name
          case date
          case description
          case data = &quot;items&quot;
      }
  
  struct Item: Codable {
      var name: String?
      var quantity: String?
  }
  
  enum SectionHeaders: Int, Codable {
      case produce = 0, seafood, meat, deli, bakery, pantry, dairy, frozen, other, total
      
      enum CodingKeys: String, CodingKey {
          case produce = &quot;produce&quot;
          case seafood = &quot;seafood&quot;
          case meat = &quot;meat&quot;
          case deli = &quot;deli&quot;
          case bakery = &quot;bakery&quot;
          case pantry = &quot;pantry&quot;
          case dairy = &quot;dairy&quot;
          case frozen = &quot;frozen&quot;
          case other = &quot;other&quot;
      }
  }
  </code></pre>
  <p>And this is the data representation I'm aiming to get:</p>
  <pre><code>&quot;title&quot;: String,
  &quot;date&quot;: String,
  &quot;description&quot;: String,
  &quot;items&quot;: [
       &quot;header1&quot;: [{
            &quot;name&quot;: String,
            &quot;quantity&quot;: String
            },
            {
            &quot;name&quot;: String,
            &quot;quantity&quot;: String
            }
       ],
       &quot;header2&quot;: [{
            &quot;name&quot;: String,
            &quot;quantity&quot;: String
            },
            {
            &quot;name&quot;: String,
            &quot;quantity&quot;: String
            }
       ]
  ]
  </code></pre>
  <p>Any help would be great! Thanks in advance!</p>