Skip to content
Closure support for handling gesture recognizers in Swift.
Branch: master
Clone or download
Pull request Compare This branch is 1 commit ahead, 12 commits behind marcbaldwin:master.
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.
GestureRecognizerClosures.xcodeproj
GestureRecognizerClosures.xcworkspace
GestureRecognizerClosures
GestureRecognizerClosuresTests
.gitignore
.swift-version
.travis.yml
CHANGELOG.md
GestureRecognizerClosures.podspec
LICENSE
Podfile
Podfile.lock
README.md

README.md

Gesture Recognizer Closures

Swift 3 Platform License Pod Build Status

Closure handlers for gesture recognizers, controls and bar button items.

GestureRecognizerClosures supports

Gesture Recognizer Examples

Example of handling a single tap

view.onTap { _ in
    // Do something
}

Example of handling a double tap

view.onDoubleTap { _ in
    // Do something
}

Example of handling a long press

view.onLongPress { _ in
    // Do something
}

Example of handling a pinch

view.onPinch { pinch in
    // Do something
}

Example of handling a pan

view.onPan { pan in
    // Do something
}

Example of handling a rotation

view.onRotate { rotate in
    // Do something
}

Example of handling a screen edge pan

view.onScreenEdgePan { _ in
    // Do something
}

Example of handling a swipe left

view.onSwipeLeft { _ in
    // Do something
}

Example of handling a swipe right

view.onSwipeRight { _ in
    // Do something
}

Example of handling a swipe up

view.onSwipeUp { _ in
    // Do something
}

Example of handling a swipe down

view.onSwipeDown { _ in
    // Do something
}

Bar Button Item Example

let barButtonItem = UIBarButtonItem(title: "Save", style: .Plain) { [unowned self] _ in
  self.save()
}

Control Example

slider.on(.ValueChanged) { [unowned self] _ in
  self.volume = self.slider.value
}

Installation

Use CocoaPods

CocoaPods is a dependency manager for Cocoa projects that supports embedded frameworks for Swift.

For instructions on how to install and use CocoaPods checkout the guides.

New CocoaPods Project

To integrate GestureRecognizerClosures into your Xcode project that is not currently using CocoaPods specify it in a new Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'GestureRecognizerClosures', '~> 3'

Then, run the following command:

$ pod install

Existing CocoaPods Project

To integrate GestureRecognizerClosures into your existing CocoaPods Xcode project specify it in your Podfile:

pod 'GestureRecognizerClosures', '~> 3'

Then, run the following command:

$ pod install

Use Carthage

You can use Carthage to install GestureRecognizerClosures by adding it to your Cartfile:

github "marcbaldwin/GestureRecognizerClosures"

Updating

Use CocoaPods

To update to the latest version of GestureRecognizerClosures run the following command:

$ pod update

Change Log

You can view the change log here.

You can’t perform that action at this time.