title: Accessing struct object array in no of rows in section returning null
body: <p>I am trying to download data and put it in struct objects and trying to load data in table view  .I am downloading it in to array and append it to struct object.when I am taking return array.count  in no of rows in section its working when I use  return objectArray[section].funcName.count  its not working values are getting late to download also</p>
  
  <pre><code>    import UIKit
  import Alamofire
  
  class GalleryVC: UIViewController,UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate {
      @IBOutlet weak var searchBar: UISearchBar!
      @IBOutlet weak var galleryTable: UITableView!
      var imageUrlArray:[String] = [String]()
      var imageCount:[String] = [String]()
      var funName1:[String] = [String]()
      var gaimage1:String = ""
      var gacount1:String = ""
      var funname1:String = ""
      struct Objects {
          var imageName : [String]!
          var imageCount : [String]!
          var funcName:[String]!
          }
      var objectArray = [Objects]()
      var objectArrayFilter = [Objects]()
      var inSearchMode = false
      override func viewDidLoad() {
          super.viewDidLoad()
          downloadGalleryList()
          galleryTable.delegate = self
          galleryTable.dataSource = self
          searchBar.delegate = self
          self.hideKeyboardWhenTappedAround()
      }
      func numberOfSections(in tableView: UITableView) -&gt; Int {
          return 1
      }
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int
      {
              print(objectArray[section].funcName.count)
              return objectArray[section].funcName.count
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          if let cell = tableView.dequeueReusableCell(withIdentifier:"gallerycell", for: indexPath) as? GalleryListCell{
  
              if inSearchMode{
  
                  cell.galleryImage.sd_setImage(with: URL(string: objectArrayFilter[indexPath.section].imageName[indexPath.row]), placeholderImage: UIImage(named: "1862205"))
                  cell.galleryphotono.text = objectArrayFilter[indexPath.section].imageCount[indexPath.row]+" photos"
                  cell.galleryFunction.text = objectArrayFilter[indexPath.section].funcName[indexPath.row]
  
                  return cell
  
              }
  
              cell.galleryImage.sd_setImage(with: URL(string: objectArray[indexPath.section].imageName[indexPath.row]), placeholderImage: UIImage(named: "1862205"))
              cell.galleryphotono.text = objectArray[indexPath.section].imageCount[indexPath.row]+" photos"
              cell.galleryFunction.text = objectArray[indexPath.section].funcName[indexPath.row]
  
              return cell
          }
          else{
              return UITableViewCell()
          }
      }
  
  
      func downloadGalleryList(){
  
          let bmiChapterUrl = URL(string:Gallery_List)!
          Alamofire.request(bmiChapterUrl).responseJSON{ response in
              let result = response.result
              print(response)
              print(result)
  
  
              if let dict = result.value as? Dictionary&lt;String,AnyObject&gt;{
  
                  if let bmi = dict["result"] as? [Dictionary&lt;String,AnyObject&gt;]
                  {
  
  
                      for obj in bmi {
  
                          if let gaimage = obj["image"] as? String
                          {
                              print(gaimage)
                              self.gaimage1 = gaimage
  
                              self.imageUrlArray.append(gaimage)
  
                          }
                          if let gacount = obj["count"] as? String
                          {
                              self.gacount1 = gacount
                              print(gacount)
  
                              self.imageCount.append(gacount)
  
                          }
  
                          if let funname = obj["event"] as? String
                          {
                              print(funname)
                              self.funname1 = funname
                              self.funName1.append(funname)
                          }
  
  
                      }
  
                  }
              }
  
              print(self.imageUrlArray,self.imageCount,self.funName1
              )
              self.objectArray.append(Objects(imageName: self.imageUrlArray, imageCount:self.imageCount,funcName: self.funName1))
              print(self.objectArray)
  
              self.galleryTable.reloadData()
  
          }
      }
  
      func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
  
          if searchBar.text == nil || searchBar.text == "" {
  
              inSearchMode = false
  
              view.endEditing(true)
  
              galleryTable.reloadData()
  
          } else {
  
              inSearchMode = true
  
  
              objectArrayFilter = objectArray.filter { $0.imageName.contains(where: { $0.contains(searchBar.text!) }) }
  
              print(objectArrayFilter)
  
              galleryTable.reloadData()
  
  
          }
      }
  }
  </code></pre>