Disposition, easier setters for CGRects

CGRects are widely used in iOS and OSX development, but some useful setters (particularly CGRectSetSize and CGRectSetOrigin) are definetively missing. So, I’ve programmed Disposition, a set of functions that can help avoid some unnecessary code when setting up CGRect’s properties.

The header file, currently defines the following fancy functions (which I hope increases over time and with the help of collaborations):

void CGRectSetSize(CGRect *rect, CGSize size);
void CGRectSetWidth(CGRect *rect, CGFloat width);
void CGRectSetHeight(CGRect *rect, CGFloat height);

void CGRectSetOrigin(CGRect *rect, CGPoint originPoint);
void CGRectSetX(CGRect *rect, CGFloat x);
void CGRectSetY(CGRect *rect, CGFloat y);

As usual, distributed under a MIT License.

Leave a Reply

Your email address will not be published. Required fields are marked *