---
title: "bitmapImageRepForCachingDisplay(in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/bitmapimagerepforcachingdisplay(in:)"
---

# bitmapImageRepForCachingDisplay(in:)

Returns a bitmap-representation object suitable for caching the specified portion of the view.

## Declaration

```swift
func bitmapImageRepForCachingDisplay(in rect: NSRect) -> NSBitmapImageRep?
```

## Parameters

- `rect`: A rectangle defining the area of the view to be cached.

## Return Value

Return Value An autoreleased NSBitmapImageRep object or nil if the object could not be created.

## Discussion

Discussion Passing the visible rectangle of the view ([self visibleRect]) returns a bitmap suitable for caching the current contents of the view, including all of its descendants.

## See Also

### Drawing the View’s Content

- [updateLayer()](appkit/nsview/updatelayer().md)
- [draw(_:)](appkit/nsview/draw(_:).md)
- [clipsToBounds](appkit/nsview/clipstobounds.md)
- [canDrawConcurrently](appkit/nsview/candrawconcurrently.md)
- [visibleRect](appkit/nsview/visiblerect.md)
- [getRectsBeingDrawn(_:count:)](appkit/nsview/getrectsbeingdrawn(_:count:).md)
- [needsToDraw(_:)](appkit/nsview/needstodraw(_:).md)
- [wantsDefaultClipping](appkit/nsview/wantsdefaultclipping.md)
- [cacheDisplay(in:to:)](appkit/nsview/cachedisplay(in:to:).md)
- [NSBorderType](appkit/nsbordertype.md)
