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.

View

Scroll Gesture Axis Lock

Sets whether scrollable views within this view lock each scroll gesture to its predominant axis. On macOS, scroll gestures lock to their predominant axis by default. On iOS, iPadOS, Mac Catalyst, visionOS, and watchOS, scroll gestures move along both axes at once.

Explore Scroll Gesture Axis Lock on iPhone in portrait, with SwiftUI code and Apple API documentation.

ScrollView([.horizontal, .vertical]) {
    Image(.cats)
}
#if os(macOS)
.scrollGestureAxisLock(.disabled)
#else
.scrollGestureAxisLock(.directional)
#endif
iOS 27.3+ iPadOS 27.3+ macOS 27.3+ watchOS 27.3+ visionOS 27.3+

Every available iPhone screenshot for Scroll Gesture Axis Lock.

1 views