4

I'm using Swift's stride for the first time. However first is on the verge of being the last since I can't get this to work:

let boundingBox = createdShape.frame //=SKShapeNode
stride(from: Int(boundingBox.minX), to: Int(boundingBox.maxX), by: 10) {

The result is:

Cannot invoke 'stride' with an argument list of type '(from: Int, to: Int, by: Int, () -> ())'

What am I doing wrong?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user594883
  • 1,329
  • 2
  • 17
  • 36

1 Answers1

1

The syntax should be:

let boundingBox = createdShape.frame //=SKShapeNode
for x in stride(from: Int(boundingBox.minX), to: Int(boundingBox.maxX), by: 10) {
  // TODO: Use x here.
}
ganzogo
  • 2,516
  • 24
  • 36