---
title: "appearance(whenContainedInInstancesOf:)"
framework: uikit
role: symbol
role_heading: Type Method
path: "uikit/uiappearance/appearance(whencontainedininstancesof:)"
---

# appearance(whenContainedInInstancesOf:)

Returns the appearance proxy for the object when it’s contained in the hierarchy the specified classes describe.

## Declaration

```swift
static func appearance(whenContainedInInstancesOf containerTypes: [any UIAppearanceContainer.Type]) -> Self
```

## Parameters

- `containerTypes`: An array of appearance container classes, in ascending hierarchical order.

## Return Value

Return Value The appearance proxy to use for the object.

## Discussion

Discussion Set the containerTypes array to an ascending hierarchical list of containing types. For example, if you want a navigation bar to take on a specific appearance when contained in a navigation controller inside a tab bar controller, set containerTypes to [UINavigationController.self, UITabBarController.self] (Swift) or @[[UINavigationController class], [UITabBarController class]] (Objective-C). Do not set containerTypes to an unrelated list of types or to a list that does not match the containment hierarchy of your user interface.

## See Also

### Working with the appearance proxy

- [appearance()](uikit/uiappearance/appearance().md)
- [appearance(for:)](uikit/uiappearance/appearance(for:).md)
- [appearance(for:whenContainedInInstancesOf:)](uikit/uiappearance/appearance(for:whencontainedininstancesof:).md)
