I developed an app in Swift 2.0 years ago, it ran smoothly. Today I updated the code to 3.0 (and later would to 4.0) but I am getting an issue saying "Left side of mutating operator isn't mutable '..<' returns immutable value" I can't seem to solve.
This answer of removing the '=' from '+=' did not work for me, hope someone can help me get this resolved.
for i: CGFloat in 0 ..< self.frame.size.width / (groundTexture.size().width) += 1 {
The full code looks like this:
func moveGroundFunc(_ duration: TimeInterval, piece: SKSpriteNode) {
let groundMovingLeft = SKAction.moveBy(x: groundTexture.size().width, y: 0, duration: duration)
let resetGround = SKAction.moveBy(x: -groundTexture.size().width, y: 0, duration: 0)
let groundMovingLeftForever = SKAction.repeatForever(SKAction.sequence([groundMovingLeft, resetGround]))
for i: CGFloat in 0 ..< self.frame.size.width / (groundTexture.size().width) += 1 {
piece.size = CGSize(width: 1500, height: groundPiece.size.height)
piece.position = CGPoint(x: i * piece.size.width, y: piece.size.height - 75)
}