var Array = [String]()
NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: #selector(ViewController.func), userInfo: nil, repeats: true)
func(){
Array.removeAll()
...
for value in data{
...
Array.append(string_value)
...
}
...
tableView.reloadData()
}
then
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCel{
cell.label.text = Array[indexPath.row]
return cell
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.Array.count
}
and when an update (tableView.reloadData()) -> fatal error:
Index out of range
tell me what my mistake?