title: how can I refresh data in a collection view in swift 4?
body: <p>I have a function to refresh the data of an array every 2 seconds </p>
  
  <pre><code>var timer = Timer()
  
  func timeRefresh(){
      timer = Timer.scheduledTimer(timeInterval: 2, target: self, selector: #selector(ViewController.refreshData), userInfo: nil, repeats: true)
  
  }
  </code></pre>
  
  <p>I receive the data from a post service</p>
  
  <pre><code>@objc func refreshData(){
  
      post(postString, Route) { (res) in
  
          let success = res["success"]
  
          if success == true {
              let walkers = res["walkers"]
  
              for secondItem in walkers.array! {
                  let duration = secondItem["duration"]
  
                  self.timeCar.append(duration.stringValue) //this is the info that i need for the collection view
  
                  }
              }
  
              print("array time \(self.timeCar)")
  
          }else{
              self.timeCar = ["-.-","-.-","-.-","-.-","-.-"]
          }
      }
  }
  </code></pre>
  
  <p>I need refresh the collection view every second </p>
  
  <pre><code>cell.typeLabel.text = timeCar[indexPath.row]
  </code></pre>