CGRect

struct CGRect
  • Mechanica

    Returns a CGRect value initialized with an origin at (0,0) and the provided width and height.

    Declaration

    Swift

    public init(width: CGFloat, height: CGFloat)

    Parameters

    width

    The width.

    height

    The height.

  • Mechanica

    The center point.

    Declaration

    Swift

    public var center: CGPoint { get set }
  • Mechanica

    Returns the CGRect area.

    Declaration

    Swift

    public var area: CGFloat { get }
  • Mechanica

    Returns a CGRect rounded to an integral value using the specified rounding rule.

    Example:

    CGRect(x: 10.3, y: 11.5, width: 12.7, height: 13.0).rounded(rule: .down) -> CGRect(x: 10, y: 11, width: 12, height: 13)
    CGRect(x: 10.3, y: 11.5, width: 12.7, height: 13.0).rounded(rule: .up) -> CGRect(x: 11, y: 12, width: 13, height: 13)
    

    Declaration

    Swift

    public func rounded(rule: FloatingPointRoundingRule) -> CGRect