Swift 2.0 : 'enumerate' is unavailable: call the 'enumerate()' method on the sequence

时间:2024-04-23 04:25:33

Swift 2.0 : 'enumerate' is unavailable: call the 'enumerate()' method on the sequence

如下代码:

      for (index,cell) in enumerate(self.tableView.visibleCells){
if let acell = cell as? ChatCell {
acell.changeColor(self.isWhiteBackground)
}
}

修改为如下:

      for (index,cell) in self.tableView.visibleCells.enumerate(){
if let acell = cell as? ChatCell {
acell.changeColor(self.isWhiteBackground)
}
}

http://*.com/questions/30730387/swift-2-0-enumerate-is-unavailable-call-the-enumerate-method-on-the-seq

查找原因如下,Swift 2.0 : 'enumerate' is unavailable: call the 'enumerate()' method on the sequence