<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/EnvironmentValues/isPresented",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI17EnvironmentValuesVAAE11isPresentedSbvp"
  },
  "title" : "isPresented"
}
-->

# isPresented

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

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

## Discussion

You can read this value like any of the other [`EnvironmentValues`](/documentation/SwiftUI/EnvironmentValues)
by creating a property with the [`Environment`](/documentation/SwiftUI/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:_:)`](/documentation/SwiftUI/View/onChange(of:initial:_:))
modifier:

```
.onChange(of: isPresented) { _, isPresented in
    if isPresented {
        // Do something when first presented.
    }
}
```

This behaves differently than [`onAppear(perform:)`](/documentation/SwiftUI/View/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`](/documentation/SwiftUI/EnvironmentValues/dismiss).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)