---
title: "presentationCompactAdaptation(horizontal:vertical:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/presentationcompactadaptation(horizontal:vertical:)"
---

# presentationCompactAdaptation(horizontal:vertical:)

Specifies how to adapt a presentation to horizontally and vertically compact size classes.

## Declaration

```swift
nonisolated func presentationCompactAdaptation(horizontal horizontalAdaptation: PresentationAdaptation, vertical verticalAdaptation: PresentationAdaptation) -> some View

```

## Parameters

- `horizontalAdaptation`: The adaptation to use in a horizontally compact size class.
- `verticalAdaptation`: The adaptation to use in a vertically compact size class. In a size class that is both horizontally and vertically compact, SwiftUI uses the verticalAdaptation value.

## Discussion

Discussion Some presentations adapt their appearance depending on the context. For example, a popover presentation over a horizontally-compact view uses a sheet appearance by default. Use this modifier to indicate a custom adaptation preference. struct ContentView: View {     @State private var showInfo = false

var body: some View {         Button("View Info") {             showInfo = true         }         .popover(isPresented: $showInfo) {             InfoView()                 .presentationCompactAdaptation(                     horizontal: .popover,                     vertical: .sheet)         }     } } If you want to specify the same adaptation for both dimensions, use the presentationCompactAdaptation(_:) method instead.

## See Also

### Adapting a presentation size

- [presentationCompactAdaptation(_:)](swiftui/view/presentationcompactadaptation(_:).md)
- [PresentationAdaptation](swiftui/presentationadaptation.md)
- [presentationSizing(_:)](swiftui/view/presentationsizing(_:).md)
- [PresentationSizing](swiftui/presentationsizing.md)
- [PresentationSizingRoot](swiftui/presentationsizingroot.md)
- [PresentationSizingContext](swiftui/presentationsizingcontext.md)
