I am updating my Swift code for Swift 3 (really excited) and am still so good. But I really hit one small code that I seem to be unable to update.
I KNOW that I am missing something very simple, but I just donβt see that.
Here is what I have in Swift 2.2:
var column = 0 [...] for item in 0 ..< collectionView!.numberOfItemsInSection(0) { [...] column = column >= (numberOfColumns - 1) ? 0 : ++column }
++column , of course, is deprecated in Swift 3 in favor of column += 1
However, in this context, an error occurs:
No '+ =' candidates call the expected type of context result 'Int'
Since this line of code ( column = column >= (numberOfColumns - 1) ? 0 : column += 1 ) is causing an error, I tried the following:
var newCol = column column = column >= (numberOfColumns - 1) ? 0 : newCol += 1
But I get the same error.
Can someone point me in the right direction?
ios swift swift3
Benjamin
source share