title: Swift array append not working on collectionView reload data
body: <p>Inside of my collectionView cell i have a nested collection view. It is first updated after making an api call (didSet), but in a load more mechanism when i try to append data to the data source array and reload the collectionView..the changes are not reflected. Here is my code</p>
  
  <pre><code>class PhotosCollectionViewController:    
  
     UICollectionViewCell,UICollectionViewDelegate,
     UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
  
  
  let network = networkingService()
  let keychain = KeychainSwift()
  
  var userID: String?
  var code: String?
  
   var platesID: String!{
  
      didSet{
  
           let parameters: Parameters = ["code": code!, "userID": userID!, 
    "plateID": platesID!]
  
          network.makeGetRequestDecodable(parameters: parameters, url: 
           "endpoint") { (reponse) in
  
  
              do {
  
  
                  let modeled = try JSONDecoder().decode([gps_sing].self, from:reponse)
  
                  self.gps_singleton_posts = modeled
                  print("Reload Method Called")
                  self.appsCollectionView?.reloadData()
  
  
              } catch let err {
                  print(err)
              }
  
  
          }
  
  
      }
  
  }
   var gps_singleton_posts: [gps_sing]?
  let gridId = "gridID"
  var appsCollectionView: UICollectionView? = {
  
      let layout = UICollectionViewFlowLayout()
      layout.minimumInteritemSpacing = 0
      layout.minimumLineSpacing = 3
  
  
      let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
      collectionView.backgroundColor = UIColor.white
  
      collectionView.translatesAutoresizingMaskIntoConstraints = false
      return collectionView
  
  }()
  
  override init(frame: CGRect) {
  
      super.init(frame: frame)
  
  
  
  
  
      if let value = keychain.get("userID") {
          self.userID = value
          // print("keychain\(self.userID!)")
      }
      if let value = keychain.get("security_token") {
          self.code = value
          // print("keychain\(self.code!)")
      }
  
  
      appsCollectionView?.dataSource = self
      appsCollectionView?.delegate = self
      appsCollectionView?.contentInset = UIEdgeInsetsMake(60, 0, 0, 0)
       appsCollectionView?.scrollIndicatorInsets =  UIEdgeInsetsMake(60, 
       0, 0, 0)
  
      addSubview(appsCollectionView!);
  
  
      addConstraintsWithFormat("H:|[v0]|", views: appsCollectionView!)
      addConstraintsWithFormat("V:|[v0]|", views: appsCollectionView!)
      appsCollectionView?.register(ImageCell.self, 
      forCellWithReuseIdentifier: gridId)
  }
  
  required init?(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
  }
  
  
  
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -&gt; CGSize {
  
      return CGSize(width: 123, height: 123)
  
  }
  
  func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
  
      print(gps_singleton_posts)
      if let count = gps_singleton_posts?.count{
  
          return count
      }
  
      return 0
  }
  func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  
  
  let parameters: Parameters = ["code": code!, "userID": userID!, 
  "plateID": platesID!,"token":"loadScroll","lim":gps_singleton_posts! 
  [(gps_singleton_posts!.count)-1].id!]
  
  
    network.makeGetRequestDecodable(parameters: parameters, url: "get/getGridPS.php") { (reponse) in
  
  
          do {
  
  
              let modeled = try JSONDecoder().decode([gps_sing].self, from:reponse)
  
              for model in modeled{
                  self.gps_singleton_posts?.append(model)
              }
             print("Reload Method Called")
              collectionView.reloadData()
              print(self.gps_singleton_posts)
  
          } catch let err {
              print(err)
           }
      }
  }
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
  
      print(self.gps_singleton_posts?.count)
  
      let cell = collectionView.dequeueReusableCell(withReuseIdentifier: gridId, for: indexPath)
          as! ImageCell
  
      cell.backgroundColor = UIColor.red
      cell.singlePost = gps_singleton_posts![indexPath.row]
  
      return cell
  
  }
  func scrollViewDidScroll(_ scrollView: UIScrollView) {
  
  
      scrollView.isScrollEnabled = false
  }
  
  
   }
  
  
   class ImageCell: UICollectionViewCell {
  
  
  var imageViewGrid: UIImageView = {
      let imageView = UIImageView()
      imageView.contentMode = .scaleAspectFill
      imageView.frame = CGRect(x: 0, y:0 , width: 100, height: 100)
      imageView.image = UIImage(named: "delete")
      imageView.clipsToBounds = true
      imageView.translatesAutoresizingMaskIntoConstraints = false
      return imageView
  }()
  
  var textLabel: UILabel = {
  
      let lv = UILabel()
      lv.textColor = UIColor.red
      lv.translatesAutoresizingMaskIntoConstraints = false
      return lv
  }()
  
  var singlePost: gps_sing! {
  
      didSet{
  
          let imageUrl = singlePost.uid
          print(imageUrl!)
  
          imageViewGrid.setImageWith(NSURL(string: imageUrl!)! as URL)
  
  
      }
  
  }
  
  override init(frame: CGRect) {
      super.init(frame: frame)
      setUpViews()
  }
  
  func setUpViews(){
  
      addSubview(imageViewGrid)
      addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[v0]|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": imageViewGrid]))
  
  
      addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[v0]|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": imageViewGrid]))
  
  }
  
  required init?(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
  } 
    }
  </code></pre>
  
  <p>In the above code (didSelectAt) function is used to load more items..but the changes are not reflected. Pleas help me out. Thanks a lot for answering my question.</p>