将Xcode更新为版本6.3后,函数中出现错误" rotateBlocks":
无法表达元组转换'(索引:Int,元素:(columnDiff: Int,rowDiff:Int))' to'(Int,(Int,Int))
以下代码:
final func initializeBlocks() {
if let blockRowColumnTranslations = blockRowColumnPositions[orientation] {
for i in 0..<blockRowColumnTranslations.count {
let blockRow = row + blockRowColumnTranslations[i].rowDiff
let blockColumn = column + blockRowColumnTranslations[i].columnDiff
let newBlock = Block(column: blockColumn, row: blockRow, color: color)
blocks.append(newBlock)
}
}
}
final func rotateBlocks(orientation: Orientation) {
if let blockRowColumnTranslation:Array<(columnDiff: Int, rowDiff: Int)> = blockRowColumnPositions[orientation] {
for (idx, (columnDiff:Int, rowDiff:Int)) in enumerate(blockRowColumnTranslation)
{
blocks[idx].column = column + columnDiff
blocks[idx].row = row + rowDiff
}
}
}