Skip to content
SwiftUISwipeGesture lets you use UIKit gestures in SwiftUI.
Swift
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.swiftpm/xcode/package.xcworkspace
Resources
Sources/SwiftUIGestures
Tests
.gitignore
LICENSE
Package.swift
README.md

README.md

Version Swift UI Swift 5.1 License Twitter: @danielsaidi

About SwiftUIGestures

SwiftUIGestures lets you use the native UISwipeGestureRecognizer in SwiftUI.

SwipeGesture is a regular SwiftUI view that can be created with any swipe directions you like:

SwipeGesture(
    up: { print("UP") },
    left: { print("LEFT") },
    right: { print("RIGHT") },
    down: { print("DOWN") }
)

However, to add swipe gestures to any SwiftUI view, you can just use the onSwipeGesture modifier:

Color.red
    .onSwipeGesture(
        up: { print("UP") },
        left: { print("LEFT") },
        right: { print("RIGHT") },
        down: { print("DOWN") }
    )
)

Ongoing work

This package will evolve over a series of articles where I show readers how to create a SPM package. You can find the first post here.

This package will eventually support CocoaPods, Carthage, Fastlane and Bitrise, contain a demo application and much more. For now, it's pretty limited.

Demo App

Coming soon

Installation

Swift Package Manager

https://github.com/danielsaidi/SwiftUIGestures.git

CocoaPods

Coming soon

Carthage

Coming soon

Contact me

Feel free to reach out if you have questions or if you want to contribute in any way:

License

SwiftUIGestures is available under the MIT license. See LICENSE file for more info.

You can’t perform that action at this time.