Giter Site home page Giter Site logo

kylegoslan / gesturerecognizerclosures Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcbaldwin/gesturerecognizerclosures

0.0 1.0 0.0 141 KB

Closure support for handling gesture recognizers in Swift.

License: MIT License

Objective-C 0.85% Swift 95.26% Ruby 3.89%

gesturerecognizerclosures's Introduction

Gesture Recognizer Closures

Swift 5 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', '~> 5'

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', '~> 5'

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.

gesturerecognizerclosures's People

Contributors

marcbaldwin avatar ewg777 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.