<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISheetPresentationController/Detent/custom(identifier:resolver:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:So35UISheetPresentationControllerDetentC5UIKitE6custom10identifier8resolverABSo0abcD10IdentifieraSg_14CoreFoundation7CGFloatVSgSo0abcD17ResolutionContext_pctFZ"
  },
  "title" : "custom(identifier:resolver:)"
}
-->

# custom(identifier:resolver:)

Creates a custom detent for a sheet by computing its value according to the properties of the provided context.

```
@MainActor @preconcurrency static func custom(identifier: UISheetPresentationController.Detent.Identifier? = nil, resolver: @escaping (any UISheetPresentationControllerDetentResolutionContext) -> CGFloat?) -> UISheetPresentationController.Detent
```

## Parameters

`identifier`

An identifier for the detent. Specify a unique identifier for each custom detent for a sheet. If you don’t specify an identifier, the system generates a random identifier.

`resolver`

A closure for resolving the detent value with an input of type [`UISheetPresentationControllerDetentResolutionContext`](/documentation/UIKit/UISheetPresentationControllerDetentResolutionContext). The value you return from this closure is a height within the safe area of the sheet. For example, return `200` for a detent with a height of `200` plus [`safeAreaInsets`](/documentation/UIKit/UIView/safeAreaInsets).[`bottom`](/documentation/UIKit/UIEdgeInsets/bottom) when the sheet is edge-attached, or `200` when the sheet is floating. Return `nil` to specify that the detent is inactive according to the provided context.

    If the closure depends on any external inputs, call [`invalidateDetents()`](/documentation/UIKit/UISheetPresentationController/invalidateDetents())     on the sheet when the external inputs change.

    Don’t set any properties on [`UISheetPresentationController`](/documentation/UIKit/UISheetPresentationController)     during the execution of this closure.

## Discussion

---

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)