---
title: "sticky(horizontal:vertical:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/presentationsizing/sticky(horizontal:vertical:)"
---

# sticky(horizontal:vertical:)

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

## Declaration

```swift
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

Return Value A modified version of self sticking to dimensions specified

## Discussion

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))   } note: fitted(horizontal:vertical:)

## See Also

### Creating custom presentation size

- [fitted(horizontal:vertical:)](swiftui/presentationsizing/fitted(horizontal:vertical:).md)
- [proposedSize(for:context:)](swiftui/presentationsizing/proposedsize(for:context:).md)
