Latest 1.0.0
License MIT
Platforms ios 8.0, requires ARC

BlockyGestures is a small framework written in Swift that allows you to create gesture recognizers that execute a closure instead of the old target-action pattern.


  • [x] Cocoapods support
  • [x] Carthage support


  • iOS 8.0+
  • Xcode 8.1+
  • Swift 3.0+


Simple use case

import BlockyGestures

let gesture = UITapGestureRecognizer().perfoming {
    // The code you would regularly put in the action selector

Specialized use case

You can perform different actions in each gesture recognizer state

import BlockyGestures

let gesture = UIPanGestureRecognizer()
gesture.performing(when: .ended) { 
    // Your code here

gesture.performing(when: [.began, .changed]) { 
    // Your other code here

NOTE: Currently you can only add a single closure for each gesture recognizer state.

Capturing gesture recognizer in closure

Currently the closure is of type () -> Void, so you will not recieve a reference to the gesture. To capture the gesute within the closure, you have to split your code like so:

let gesture = UISwipeGesture()
gesture.performing {
    // Your code here



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build BlockyGestures 1.0.0+.

To integrate BlockyGestures into your Xcode project using CocoaPods, specify it in your Podfile:

source ''
platform :ios, '10.0'

target '<Your Target Name>' do
    pod 'BlockyGestures', '~> 1.0'

Then, run the following command:

$ pod install


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate BlockyGestures into your Xcode project using Carthage, specify it in your Cartfile:

github "lordzsolt/BlockyGestures" ~> 1.0

Run carthage update to build the framework and drag the built BlockyGestures.framework into your Xcode project.


  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.


BlockyGestures is released under the MIT license. See LICENSE for details.

Latest podspec

    "name": "BlockyGestures",
    "version": "1.0.0",
    "summary": "A small framework written in Swift that adds closures to UIGestureRecognizer",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Zsolt Kovacs": "[email protected]"
    "platforms": {
        "ios": "8.0"
    "requires_arc": true,
    "source": {
        "git": "",
        "tag": "1.0.0"
    "source_files": "BlockyGestures/**/*.{h,swift}",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This