custom(identifier:resolver:)
Creates a custom detent for a sheet by computing its value according to the properties of the provided context.
Declaration
@MainActor @preconcurrency static func custom(identifier: UISheetPresentationController.Detent.Identifier? = nil, resolver: @escaping (any UISheetPresentationControllerDetentResolutionContext) -> CGFloat?) -> UISheetPresentationController.DetentParameters
- 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. The value you return from this closure is a height within the safe area of the sheet. For example, return
200for a detent with a height of200plus Safeareainsets.Bottom when the sheet is edge-attached, or200when the sheet is floating. Returnnilto specify that the detent is inactive according to the provided context.If the closure depends on any external inputs, call Invalidatedetents() on the sheet when the external inputs change.
Don’t set any properties on Uisheetpresentationcontroller during the execution of this closure.