iPhone SwiftUI layouts

Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.

Button

Button Sizing

The preferred sizing behavior of buttons in the view hierarchy.

Explore Button Sizing on iPhone in portrait, with SwiftUI code and Apple API documentation.

HStack {
    Button("Tap Me", action: action)
        .buttonStyle(.borderedProminent)
        .buttonSizing(.fitted)
    Button("Tap Me", action: action)
        .buttonStyle(.borderedProminent)
        .buttonSizing(.flexible)
}
iOS 26.0+ iPadOS 26.0+ macOS 26.0+ watchOS 26.0+ tvOS 26.0+ visionOS 26.0+

Every available iPhone screenshot for Button Sizing.

1 views