Contents

addRect(_:transform:)

Adds a rectangular subpath to the path.

Declaration

mutating func addRect(_ rect: CGRect, transform: CGAffineTransform = .identity)

Parameters

  • rect:

    A rectangle, specified in user space coordinates.

  • transform:

    An affine transform to apply to the rectangle before adding to the path. Defaults to the identity transform if not specified.

Discussion

This is a convenience function that adds a rectangle to a path, starting by moving to the bottom-left corner and then adding lines counter-clockwise to create a rectangle, closing the subpath.

See Also

Drawing a path