Returns by indirection a list of nonoverlapping rectangles that define the area the view is being asked to draw in
- macOS 10.3+
On return, contains a list of nonoverlapping rectangles defining areas to be drawn in. The rectangles returned in
rectsare in the coordinate space of the view.
On return, the number of rectangles in the
An implementation of
draw(_:) can use this information to test whether objects or regions within the view intersect with the rectangles in the list, and thereby avoid unnecessary drawing that would be completely clipped away.
needs method gives you a convenient way to test individual objects for intersection with the area being drawn in
draw(_:). However, you may want to retrieve and directly inspect the rectangle list if this is a more efficient way to perform intersection testing.
You should send this message only from within a
draw(_:) implementation. The
a parameter of
draw(_:) is the rectangle enclosing the returned list of rectangles; you can use it in an initial pass to reject objects that are clearly outside the area to be drawn.