CGRectIntersection(_:_:)
Returns the intersection of two rectangles.
Declaration
func CGRectIntersection(_ r1: CGRect, _ r2: CGRect) -> CGRectParameters
- r1:
The first source rectangle.
- r2:
The second source rectangle.
Return Value
A rectangle that represents the intersection of the two specified rectangles. If the two rectangles do not intersect, returns the null rectangle. To check for this condition, use CGRectIsNull(_:).
Discussion
Both rectangles are standardized prior to calculating the intersection.