---
title: viewWillAppear()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsviewcontroller/viewwillappear()
---

# viewWillAppear()

Called after the view controller’s view has been loaded into memory is about to be added to the view hierarchy in the window.

## Declaration

```swift
func viewWillAppear()
```

## Discussion

Discussion You can override this method to perform tasks prior to a view controller’s view getting added to view hierarchy, such as setting the view’s highlight color. This method is called when: The view is about to be added to the view hierarchy of the view controller The view controller’s window is about to become visible, such as coming to the front or becoming unhidden If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method. The default implementation of this method does nothing.

## See Also

### Responding to View Events

- [viewDidLoad()](appkit/nsviewcontroller/viewdidload().md)
- [loadViewIfNeeded()](appkit/nsviewcontroller/loadviewifneeded().md)
- [isViewLoaded](appkit/nsviewcontroller/isviewloaded.md)
- [viewIfLoaded](appkit/nsviewcontroller/viewifloaded.md)
- [viewDidAppear()](appkit/nsviewcontroller/viewdidappear().md)
- [viewWillDisappear()](appkit/nsviewcontroller/viewwilldisappear().md)
- [viewDidDisappear()](appkit/nsviewcontroller/viewdiddisappear().md)
