Quick step (from :, to :, by :), calling "cannot call"

I am using the Swift step for the first time. However, first it is on the verge of being the last, since I cannot get this to work:

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

Result:

Cannot call 'stride' using a list of arguments like '(from: Int, to: Int, by: Int, () → ())'

What am I doing wrong?

+4
source share
1 answer

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.
}
+1
source

Source: https://habr.com/ru/post/1660090/


All Articles