---
title: "onAppear(perform:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/onappear(perform:)"
---

# onAppear(perform:)

Adds an action to perform before this view appears.

## Declaration

```swift
nonisolated func onAppear(perform action: (() -> Void)? = nil) -> some View

```

## Parameters

- `action`: The action to perform. If action is nil, the call has no effect.

## Mentioned in

Understanding the navigation stack

## Return Value

Return Value A view that triggers action before it appears.

## Discussion

Discussion The exact moment that SwiftUI calls this method depends on the specific view type that you apply it to, but the action closure completes before the first rendered frame appears.

## See Also

### Responding to view life cycle updates

- [onDisappear(perform:)](swiftui/view/ondisappear(perform:).md)
