Contents

positionX(_:y:)

Creates a constraint that restricts both coordinates of a node’s position.

Declaration

class func positionX(_ xRange: SKRange, y yRange: SKRange) -> Self

Parameters

  • xRange:

    The range to restrict the x-coordinate to.

  • yRange:

    The range to restrict the y-coordinate to.

Mentioned in

Return Value

A new constraint.

Discussion

Each time constraints are applied, the node’s position property is clamped so that both coordinates lie inside the specified ranges.

See Also

Creating Position Constraints