<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CustomPresentationDetent/height(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI24CustomPresentationDetentP6height2in14CoreFoundation7CGFloatVSgAA0dE0V7ContextV_tFZ"
  },
  "title" : "height(in:)"
}
-->

# height(in:)

Calculates and returns a height based on the context.

```
static func height(in context: Self.Context) -> CGFloat?
```

## Parameters

`context`

Information that can help to determine the
height of the detent.

## Return Value

The height of the detent, or `nil` if the detent should be
inactive based on the `context` input.

---

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)