In the process of programming in swift, I encountered such a problem which confused me.
as shown in the picture above。
I found that the maxY property of CGRect is actually not included in CGRect. Because for a CGRect whose origin coordinate is (0, 0) and the length and width are 100, its actual maxY should be (0, 99).
I also found that the same problem exists in Array, for example, an array of [0, 1, 2, 3, 4, 5], his subscript should be 0-5, but the endIndex property of Array is 6.
I wonder why it is designed this way, does it make any sense?

Senario 1
CGRect.contains(_:)return true only if the coordinate is inside the rectangle or it is on theminimumX&minimumYedges.If the point lies on the maximum edges it will return
false.In your case you are trying to check a point which lies on the maximum edge of the rect. So it will return ```false``.
Check the Documentation
Senario 2
endIndex of an array is defined as follows.
So in your array,
5is the last valid element which has the index of5. SoendIndexis defined as the 1 value higher than the index of the last element. So it will return6.