Swiftpack.co - ciaranrobrien/SwiftUIDelayedGesture as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ciaranrobrien.
ciaranrobrien/SwiftUIDelayedGesture 1.0.5
SwiftUI view modifiers to use gestures inside ScrollView and List.
⭐️ 32
🕓 3 years ago
iOS watchOS
.package(url: "https://github.com/ciaranrobrien/SwiftUIDelayedGesture.git", from: "1.0.5")

SwiftUI Delayed Gesture

SwiftUI view modifiers to use gestures inside ScrollView and List.

Demo

.delayedGesture()

Sequences a gesture with a long press and attaches the result to the view, which results in the gesture only receiving events after the long press succeeds.

Usage

Use this view modifier instead of .gesture() to delay a gesture:

ScrollView {
    FooView()
        .delayedGesture(someGesture, delay: 0.2)
}

Parameters

  • gesture: A gesture to attach to the view.
  • mask: A value that controls how adding this gesture to the view affects other gestures recognized by the view and its subviews.
  • delay: A value that controls the duration of the long press that must elapse before the gesture can be recognized by the view.
  • action: An action to perform if a tap gesture is recognized before the long press can be recognized by the view.

.delayedInput()

Attaches a long press gesture to the view, which results in gestures with a lower precedence only receiving events after the long press succeeds.

Usage

Use this view modifier before .gesture() to delay a gesture:

ScrollView {
    FooView()
        .delayedInput(delay: 0.2)
        .gesture(someGesture)
}

Parameters

  • delay: A value that controls the duration of the long press that must elapse before lower precedence gestures can be recognized by the view.
  • action: An action to perform if a tap gesture is recognized before the long press can be recognized by the view.

Requirements

  • iOS 14.0+ or watchOS 7.0+
  • Xcode 12.0+

Installation

Contact

@ciaranrobrien on Twitter.

GitHub

link
Stars: 32
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics