---
title: "view(forKey:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontrollercontexttransitioning/view(forkey:)"
---

# view(forKey:)

Returns the specified view involved in the transition.

## Declaration

```swift
func view(forKey key: UITransitionContextViewKey) -> UIView?
```

## Parameters

- `key`: The key identifying the view you want. For a list of possible keys, see View Transition Keys.

## Return Value

Return Value The view object for the specified key or nil if the view could not be found.

## Discussion

Discussion The view returned by this method may or may not be the root view of the corresponding view controller. A situation where the views may not be the same is when a system-provided presentation controller installs another view underneath the presented view controller’s view.

## See Also

### Accessing the transition objects

- [containerView](uikit/uiviewcontrollercontexttransitioning/containerview.md)
- [viewController(forKey:)](uikit/uiviewcontrollercontexttransitioning/viewcontroller(forkey:).md)
