.onLongPressGesture()

iOS 13+

Adds an action to perform when the view is long-pressed.

Interaction
Official Apple Documentation →
iOS User Coverage
98.1%
coverage

98.1% of iOS users can use this modifier

Version Compatibility
iOS 26.3
48.6% Supported
iOS 26.2
11.2% Supported
iOS 18.7
8.8% Supported
iOS 18.6
7.9% Supported
iOS 18.5
3.3% Supported
iOS 16.7
2.0% Supported
iOS 26.1
1.9% Supported
iOS 26.4
1.8% Supported
iOS 15.8
1.4% Supported
iOS 18.3
1.3% Supported

iOS 13+ required

Variants
.onLongPressGesture()

Basic onLongPressGesture modifier

Code Examples

Basic onLongPressGesture Usage

Apply the .onLongPressGesture() modifier to a view

Text("Hello, World!")
    .onLongPressGesture()
Frequently Asked Questions

What iOS version is required for .onLongPressGesture()?

The .onLongPressGesture() modifier requires iOS 13 or later. This means 98.1% of current iOS users can use this modifier.

How do I use .onLongPressGesture() in SwiftUI?

Apply the .onLongPressGesture() modifier to any SwiftUI view. Check the code examples above for usage patterns.

Where can I learn more?

Visit the official Apple documentation for detailed information.

Explore More SwiftUI Modifiers