title: CollectionView numberOfItemsInSection variable
body: <p>I want to have a collectionView inside another collectionView, however the data is coming from an array of arrays so numberOfItemsInSection will be variable based on which parent cell we are populating.</p>
  
  <p>in cellForItemAt indexPath: i am using the following code to extract items from my array:</p>
  
  <pre><code>innerCell.imageCell.file = GlobalParentArray.sharedInstance.globalParentArray[collectionView.tag][indexPath.item].image
  </code></pre>
  
  <p>which returns the data correctly but only if numberOfItemsInSection is equal to or less than the the count of items at this level of my array:</p>
  
  <pre><code>GlobalParentArray.sharedInstance.globalParentArray[collectionView.tag].count
  </code></pre>
  
  <p>So i need numberOfItemsInSection to be variable on this count, as this will return the number of items.  I haven't had much luck using the .tag property but am searching for a way of having these 2 functions count match up.</p>
  
  <p>this is the actual function I'm using:</p>
  
  <pre><code>   func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      if collectionView == self.outerCollectionView {
          return self.packArray.count
      } else {
  
          //return self.partArray.count
          return GlobalParentArray.sharedInstance.globalParentArray[collectionView.tag].count
      }
  }
  </code></pre>
  
  <p>Currently as this is it throws an error on this line:</p>
  
  <pre><code>fatal error: Index out of range
  (lldb)
  </code></pre>