---
title: isPresented
framework: swiftui
role: symbol
role_heading: Instance Property
path: swiftui/environmentvalues/ispresented
---

# isPresented

A Boolean value that indicates whether the view associated with this environment is currently presented.

## Declaration

```swift
var isPresented: Bool { get }
```

## Discussion

Discussion You can read this value like any of the other EnvironmentValues by creating a property with the Environment property wrapper: @Environment(\.isPresented) private var isPresented Read the value inside a view if you need to know when SwiftUI presents that view. For example, you can take an action when SwiftUI presents a view by using the onChange(of:initial:_:) modifier: .onChange(of: isPresented) { _, isPresented in     if isPresented {         // Do something when first presented.     } } This behaves differently than onAppear(perform:), which SwiftUI can call more than once for a given presentation, like when you navigate back to a view that’s already in the navigation hierarchy. To dismiss the currently presented view, use dismiss.

## See Also

### Dismissing a presentation

- [dismiss](swiftui/environmentvalues/dismiss.md)
- [DismissAction](swiftui/dismissaction.md)
- [interactiveDismissDisabled(_:)](swiftui/view/interactivedismissdisabled(_:).md)
