---
title: prepare()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsscrubberlayout/prepare()
---

# prepare()

Gives you an opportunity to perform layout calculations when the scrubber’s layout is invalidated.

## Declaration

```swift
func prepare()
```

## Discussion

Discussion Use this method in subclasses to perform layout calculations and caching in advance of rendering the scrubber. The system calls this method when the scrubber’s layout is invalidated. The base implementation of this method does nothing.

## See Also

### Subclassing a scrubber layout

- [scrubberContentSize](appkit/nsscrubberlayout/scrubbercontentsize.md)
- [layoutAttributesForItem(at:)](appkit/nsscrubberlayout/layoutattributesforitem(at:).md)
- [layoutAttributesForItems(in:)](appkit/nsscrubberlayout/layoutattributesforitems(in:).md)
- [shouldInvalidateLayoutForSelectionChange](appkit/nsscrubberlayout/shouldinvalidatelayoutforselectionchange.md)
- [shouldInvalidateLayoutForHighlightChange](appkit/nsscrubberlayout/shouldinvalidatelayoutforhighlightchange.md)
- [shouldInvalidateLayoutForChange(fromVisibleRect:toVisibleRect:)](appkit/nsscrubberlayout/shouldinvalidatelayoutforchange(fromvisiblerect:tovisiblerect:).md)
- [automaticallyMirrorsInRightToLeftLayout](appkit/nsscrubberlayout/automaticallymirrorsinrighttoleftlayout.md)
