<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/prepareForReuse()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)prepareForReuse"
  },
  "title" : "prepareForReuse()"
}
-->

# prepareForReuse()

Restores the view to an initial state so that it can be reused.

```
func prepareForReuse()
```

## Discussion

The default implementation of this method sets the view’s alpha to `1.0` and its hidden state to <doc://com.apple.documentation/documentation/Swift/false>. Subclasses can override this method and use it to return the view to its initial state. Subclasses should call `super` at some point in their implementation.

This method offers a way to reset a view to some initial state so that it can be reused. For example, the [`NSTableView`](/documentation/AppKit/NSTableView) class uses it to prepare views for reuse and thereby avoid the expense of creating new views as they scroll into view. If you implement a view-reuse system in your own code, you can call this method from your own code prior to reusing them.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)