The following functions are available globally.
Calculates the stacking of rectangles within a larger rectangle. The resulting rectangle is stacked counter clockwise along the edge specified. As soon as there are more rects than will fit, a new row is started, thus, they are stacked by column, then by row.
reversewill cause them to be stacked counter-clockwise along the specified edge.
CGRect CGRectStackedWithinRectFromEdge(CGRect rect, CGSize size, int count, CGRectEdge edge, _Bool reverse)
func CGRectStackedWithinRectFromEdge(_ rect: CGRect, _ size: CGSize, _ count: Int32, _ edge: CGRectEdge, _ reverse: Bool) -> CGRect