---
title: "viewWillAppear(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontroller/viewwillappear(_:)"
---

# viewWillAppear(_:)

Notifies the view controller that its view is about to be added to a view hierarchy.

## Declaration

```swift
func viewWillAppear(_ animated: Bool)
```

## Parameters

- `animated`: If doc://com.apple.documentation/documentation/Swift/true, the view is being added to the window using an animation.

## Mentioned in

Displaying and managing views with a view controller Enhancing your app with fluid transitions Handling row selection in a table view

## Discussion

Discussion This method is called before the view controller’s view is about to be added to a view hierarchy and before any animations are configured for showing the view. You can override this method to perform custom tasks associated with displaying the view. For example, you might use this method to change the orientation or style of the status bar to coordinate with the orientation or style of the view being presented. If you override this method, you must call super at some point in your implementation. For more information about the how views are added to view hierarchies by a view controller, and the sequence of messages that occur, see Supporting Accessibility. note: If a view controller is presented by a view controller inside of a popover, this method is not invoked on the presenting view controller after the presented controller is dismissed.

## See Also

### Responding to view-related events

- [viewIsAppearing(_:)](uikit/uiviewcontroller/viewisappearing(_:).md)
- [viewDidAppear(_:)](uikit/uiviewcontroller/viewdidappear(_:).md)
- [viewWillDisappear(_:)](uikit/uiviewcontroller/viewwilldisappear(_:).md)
- [viewDidDisappear(_:)](uikit/uiviewcontroller/viewdiddisappear(_:).md)
- [isBeingDismissed](uikit/uiviewcontroller/isbeingdismissed.md)
- [isBeingPresented](uikit/uiviewcontroller/isbeingpresented.md)
- [isMovingFromParent](uikit/uiviewcontroller/ismovingfromparent.md)
- [isMovingToParent](uikit/uiviewcontroller/ismovingtoparent.md)
