Contents

sticky(horizontal:vertical:)

Modifies self to be sticky in the specified dimensions — growing, but not shrinking.

Declaration

func sticky(horizontal: Bool = false, vertical: Bool = false) -> some PresentationSizing

Parameters

  • horizontal:

    A boolean indicating whether to maintain the largest size horizontally

  • vertical:

    A boolean indicating whether to maintain the largest size vertically

Return Value

A modified version of self sticking to dimensions specified

Discussion

If sticky is .vertical, the presentation can grow in the vertical and horizontal dimensions when its content size grows, but will not shrink in the vertical dimension when content size shrinks.

ContentView()
  .sheet(isPresented: $presentSheet) {
    MyDynamicSheetContent()
      .presentationSizing(
        .form.sticky(horizontal: false, vertical: true))
  }

See Also

Creating custom presentation size