1

After updating Xcode to version 6.3, an error occurs in the function "rotateBlocks":

Cannot express tuple conversion '(index: Int, element: (columnDiff: Int, rowDiff: Int))' to '(Int, (Int, Int))

Here's the code :

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
        }
    }
}
David Ansermot
  • 6,052
  • 8
  • 47
  • 82
Dmitry Kuzin
  • 656
  • 1
  • 6
  • 15
  • As explained in the referenced thread, you have to write it as `for (idx, elem:(columnDiff:Int, rowDiff:Int)) in ...` and then you can use `elem.columnDiff`. – Martin R Apr 30 '15 at 11:54

0 Answers0