zeeshan zeeshan - 4 months ago 30
iOS Question

For Swift 3 how to replace ++ increment operator in a single line if statement when += 1 not valid?

I have this line in my code:

column = column >= (numberOfColumns - 1) ? 0 : ++column


Since in Swift 3 the ++ operator will be deprecated, so I want to update this line. How do I update this line of code?

Answer

simply:

column = column >= (numberOfColumns - 1) ? 0 : column + 1