<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIHoverEffectLayer/containerView",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIHoverEffectLayer(py)containerView"
  },
  "title" : "containerView"
}
-->

# containerView

The [`UIView`](/documentation/UIKit/UIView) in which this layer is contained. This view is used to
derive traits and other properties for applying the correct hover effect
to the layer. It may also be used to assist with applying some kinds of
hover effects to the layer.

```
weak var containerView: UIView? { get set }
```

## Discussion

The [`containerView`](/documentation/UIKit/UIHoverEffectLayer/containerView) should be an ancestor of this layer (once it has
been added to a layer hierarchy) to behave correctly, but does not need
to be the immediate parent of this layer. If the [`containerView`](/documentation/UIKit/UIHoverEffectLayer/containerView) is
set to nil or is deallocated, some aspects of this layer’s hover effect
may no longer work correctly.

---

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)