Josh Schlabach Josh Schlabach - 2 months ago 13x
Swift Question

Binary operator '..<' cannot be applied to two 'Int' operands [Swift]

Okay so I was programming in my Xcode project and suddenly I got a warning that this:

for var i:CGFloat = 0; i<3; i++

will be removed in Swift 3. It gave me an option to "fix" the code to Swift 3 syntax and switched it to this:

for i:CGFloat in 0 ..< 3 {

Now my code will not run and the error it gets "Binary operator '..<' cannot be applied to two '
' operands.

Help would be nice!

for i in 0..<3 {
    let someFloat = CGFloat(i) // if you need a CGFloat

Check your spacing, remove the CGFloat type from the loop declaration.