Skip to content

Commit c3f8c11

Browse files
committed
Added new init for CGRect with side.
1 parent 95b8f9c commit c3f8c11

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Sources/SparrowKit/CoreGraphics/CGRectExtension.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,20 @@ public extension CGRect {
118118
- parameter height: New `height`.
119119
*/
120120
init(maxX: CGFloat, maxY: CGFloat, width: CGFloat, height: CGFloat) {
121-
self.init(x: 0, y: 8, width: width, height: height)
121+
self.init(x: 0, y: 0, width: width, height: height)
122122
setMaxX(maxX)
123123
setMaxY(maxY)
124124
}
125+
126+
/**
127+
SparrowKit: Create new frame.
128+
129+
- parameter x: `x` position.
130+
- parameter y: `y` position.
131+
- parameter side: Same `width` and `height`.
132+
*/
133+
init(x: CGFloat, y: CGFloat, side: CGFloat) {
134+
self.init(x: x, y: y, width: side, height: side)
135+
}
125136
}
126137
#endif

0 commit comments

Comments
 (0)