---
title: "Scroll Gesture Axis Lock | Explore SwiftUI"
description: "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"
canonical_url: "https://exploreswiftui.com/library/view/scroll-gesture-axis-lock"
meta:
  author: "Explore SwiftUI"
  "og:description": "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"
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Scroll%2BGesture%2BAxis%2BLock%2Cdescription_~U2V0cyB3aGV0aGVyIHNjcm9sbGFibGUgdmlld3Mgd2l0aGluIHRoaXMgdmlldyBsb2NrIGVhY2ggc2Nyb2xsIGdlc3R1cmUgdG8gaXRzIHByZWRvbWluYW50IGF4aXMuIE9uIG1hY09TLCBzY3JvbGwgZ2VzdHVyZXMgbG9jayB0byB0aGVpciBwcmVkb21pbmFudCBheGlzIGJ5IGRlZmF1bHQuIE9uIGlPUywgaVBhZE9TLCBNYWMgQ2F0YWx5c3QsIHZpc2lvbk9TLCBhbmQgd2F0Y2hPUywgc2Nyb2xsIGdlc3R1cmVzIG1vdmUgYWxvbmcgYm90aCBheGVzIGF0IG9uY2Uu%2Ccategory_View%2Cimage_~L2FwaS9pbWFnZXMvMjYyL3ZhcmlhbnRzLzIyMjc~dj0xNzk0ODk5NjY3NTI5JnI9MiZ3PTEyODAmcT04NSZmPWpwZWc%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidmlzaW9uT1MiXX0%2Cp_Ii9saWJyYXJ5L3ZpZXcvc2Nyb2xsLWdlc3R1cmUtYXhpcy1sb2NrIg%2Cs_UDMVZrdBX4fOEiIf.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Scroll Gesture Axis Lock | Explore SwiftUI"
  "twitter:description": "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"
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Scroll%2BGesture%2BAxis%2BLock%2Cdescription_~U2V0cyB3aGV0aGVyIHNjcm9sbGFibGUgdmlld3Mgd2l0aGluIHRoaXMgdmlldyBsb2NrIGVhY2ggc2Nyb2xsIGdlc3R1cmUgdG8gaXRzIHByZWRvbWluYW50IGF4aXMuIE9uIG1hY09TLCBzY3JvbGwgZ2VzdHVyZXMgbG9jayB0byB0aGVpciBwcmVkb21pbmFudCBheGlzIGJ5IGRlZmF1bHQuIE9uIGlPUywgaVBhZE9TLCBNYWMgQ2F0YWx5c3QsIHZpc2lvbk9TLCBhbmQgd2F0Y2hPUywgc2Nyb2xsIGdlc3R1cmVzIG1vdmUgYWxvbmcgYm90aCBheGVzIGF0IG9uY2Uu%2Ccategory_View%2Cimage_~L2FwaS9pbWFnZXMvMjYyL3ZhcmlhbnRzLzIyMjc~dj0xNzk0ODk5NjY3NTI5JnI9MiZ3PTEyODAmcT04NSZmPWpwZWc%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidmlzaW9uT1MiXX0%2Cp_Ii9saWJyYXJ5L3ZpZXcvc2Nyb2xsLWdlc3R1cmUtYXhpcy1sb2NrIg%2Cs_UDMVZrdBX4fOEiIf.png"
  "twitter:title": "Scroll Gesture Axis Lock | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

**Interactive previews**[ iPhone](https://exploreswiftui.com/iphone?element=262)

# **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.

![Scroll Gesture Axis Lock - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/262/variants/2227?v=1794899667529&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

iOS 27.3+ iPadOS 27.3+ macOS 27.3+ watchOS 27.3+ visionOS 27.3+

### **Tags**

### **SwiftUI Code**

[ Docs](<https://developer.apple.com/documentation/SwiftUI/View/scrollGestureAxisLock(_:)>)

```
ScrollView([.horizontal, .vertical]) {
    Image(.cats)
}
#if os(macOS)
.scrollGestureAxisLock(.disabled)
#else
.scrollGestureAxisLock(.directional)
#endif
```

### **Found an issue or have a suggestion?**

Created: November 17, 2026Updated: November 17, 2026

### **More View Components **

[**View all **](https://exploreswiftui.com/library/view)

![VisionOS background materials - visionOS - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/260/variants/2143?v=1793707679045&r=2&w=412&q=75&f=webp)

### **VisionOS background materials**

All background materials on visionOS

![Container Content Margins - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/257/variants/1987?v=1792070676534&r=2&w=412&q=75&f=webp)

### **Container Content Margins**

Adds the margins of the container the view is in.

![Toolbar Vertical Edge - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/254/variants/1863?v=1790589836833&r=2&w=412&q=75&f=webp)

### **Toolbar Vertical Edge**

This value reflects the system’s preferred edge for the vertical bar in the current context, regardless of whether a vertical bar is currently visible. Use it to position custom bars or other UI relative to the system’s bar placement.

![Hinge State - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/249/variants/1765?v=1793099575627&r=2&w=412&q=75&f=webp)

### **Hinge State**

A type encapsulating the state of a single hinge.

![Disabled Toolbar Vertical Behavior - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/246/variants/1636?v=1790277107518&r=2&w=412&q=75&f=webp)

### **Disabled Toolbar Vertical Behavior**

Disables the vertical bar.

![Music Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/232/variants/727?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Music Picker**

Presents a music picker to select items from the Apple Music catalog and the user’s music library.

![App Store Overlay - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/224/variants/269?v=1790073478842&r=2&w=412&q=75&f=webp)

### **App Store Overlay**

Presents a StoreKit overlay when a given condition is true.

![Manage Subscriptions Sheet - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/223/variants/241?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Manage Subscriptions Sheet**

Opens the manage subscriptions sheet.

### **Explore Other Components **

[**Browse all **](https://exploreswiftui.com/)

![Collapse Sidebar Sections by Default - iPadOS - Landscape - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/259/variants/2039?v=1792566366133&r=2&w=412&q=75&f=webp)

### **Collapse Sidebar Sections by Default**

Collapses the section in the sidebar by default.

![CircularGaugeStyle - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/47/variants/263?v=1790073478842&r=2&w=412&q=75&f=webp)

### **CircularGaugeStyle**

A gauge style that displays an open ring with a marker that appears at a point along the ring to indicate the gauge’s current value

![GraphicalDatePickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/62/variants/420?v=1790073478842&r=2&w=412&q=75&f=webp)

### **GraphicalDatePickerStyle**

A date picker style that displays an interactive calendar or clock

![Pinned Toolbar Item Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/236/variants/527?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Pinned Toolbar Item Placement**

A placement that pins the item to the trailing edge of the toolbar.

![Refreshable List - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/126/variants/359?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Refreshable List**

Marks this view as refreshable.

![ButtonToggleStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/210/variants/635?v=1790073478842&r=2&w=412&q=75&f=webp)

### **ButtonToggleStyle**

A toggle style that displays as a button with its label as the title.

![SidebarListStyle - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/107/variants/283?v=1790073478842&r=2&w=412&q=75&f=webp)

### **SidebarListStyle**

The list style that describes the behavior and appearance of a sidebar list.

![Divider Color - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/71/variants/110?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Divider Color**

Customizing the color of the Divider

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#webpage","@type":"WebPage","dateModified":"2026-11-17T07:14:27.529Z","datePublished":"2026-11-17T07:14:27.529Z","description":"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","name":"Scroll Gesture Axis Lock","url":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock","breadcrumb":{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"mainEntity":{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#article"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/view/scroll-gesture-axis-lock"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#article","citation":"https://developer.apple.com/documentation/SwiftUI/View/scrollGestureAxisLock(_:)","dateModified":"2026-11-17T07:14:27.529Z","datePublished":"2026-11-17T07:14:27.529Z","description":"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","headline":"Scroll Gesture Axis Lock","inLanguage":"en-US","name":"Scroll Gesture Axis Lock","thumbnailUrl":"https://exploreswiftui.com/api/images/262/variants/2227?v=1794899667529&r=2","url":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock","@type":["Article","TechArticle"],"about":{"@type":"Thing","name":"SwiftUI"},"author":{"@id":"https://exploreswiftui.com/#identity"},"hasPart":{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#source-code"},"image":{"@id":"https://exploreswiftui.com/#/schema/image/1"},"isPartOf":{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#webpage"},"mainEntityOfPage":{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#source-code","@type":"SoftwareSourceCode","codeSampleType":"full example","description":"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","name":"Scroll Gesture Axis Lock SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"ScrollView([.horizontal, .vertical]) {\n    Image(.cats)\n}\n#if os(macOS)\n.scrollGestureAxisLock(.disabled)\n#else\n.scrollGestureAxisLock(.directional)\n#endif","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"View"},{"@type":"Thing","name":"Scroll Gesture Axis Lock"}]},{"@id":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"View","item":"https://exploreswiftui.com/library/view","position":2},{"@type":"ListItem","name":"Scroll Gesture Axis Lock","item":"https://exploreswiftui.com/library/view/scroll-gesture-axis-lock","position":3}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"},{"@id":"https://exploreswiftui.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://exploreswiftui.com/api/images/262/variants/2227?v=1794899667529&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/262/variants/2227?v=1794899667529&r=2"}]}
```