Contents

addRoundedRect(in:cornerSize:style:transform:)

Adds a rounded rectangle to the path.

Declaration

mutating func addRoundedRect(in rect: CGRect, cornerSize: CGSize, style: RoundedCornerStyle = .continuous, transform: CGAffineTransform = .identity)

Parameters

  • rect:

    A rectangle, specified in user space coordinates.

  • cornerSize:

    The size of the corners, specified in user space coordinates.

  • style:

    The corner style. Defaults to the continous style if not specified.

  • 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 rounded rectangle to a path, starting by moving to the center of the right edge and then adding lines and curves counter-clockwise to create a rounded rectangle, closing the subpath.

See Also

Drawing a path