Best way to use UIGesture

Related tags

Gesture NiceGesture
Overview

NiceGesture

Build Status Language Carthage compatible CocoaPods License

The best way to use UIGesture

#Usage

###TapGesture:

because tapGesture is only have one state,so it's only have method whenTapped

  view.nc_addTapGestureWithConfigClosure { (tapGestureRecognizer) -> () in
            // Configure gesture recognizer,like this:
            tapGestureRecognizer.numberOfTapsRequired=2
        }.whenTapped {(tapGestureRecognizer) -> () in
            //doSomething()
        }
        
  // or you can directly do something 
  view.nc_whenTapped {(tapGestureRecognizer) -> () in
        //doSomething()
  }

###LongPress,Pan,Pinch,Rotate,Swipe,ScreenEdgesPan:

if you want to cinfigure gesture,use this method:

  view.nc_addxxxxGestureWithConfigClosure({ (gestureRecognizer) -> () in
        //Configure gesture recognizer
  })

if you needn't configure,use this method to start:

  view.nc_addxxxxGesture()

then,you can add hanlder function as you want:

   view.nc_addPanGesture()
       .whenBegan { (recognizer) -> Void in
            
       }.whenCancelled { (recognizer) -> Void in
            
       }.whenChanged { (recognizer) -> Void in
            
       }.whenEnded { (recognizer) -> Void in
            
       }.whenFailed { (recognizer) -> Void in
            
       }

a convenient way to use SwipeGesture:

   view.nc_whenSwipedInDirection(.Down) { (gestureRecognizer) in
            
        }

or if you want set one handler for many states,use whenStatesHappend:

lbState.nc_addPanGesture().whenStatesHappend([.Ended,.Changed]) { (gestureRecognizer) -> Void in
            
        }

###Attention

Custom gestureRecognizerHandler is retained by UIGestureRecognizer , UIGestureRecognizer is retained by target view, so if you're using self property remeber explicit [unowned self] to avoid retain cycle:

 lbState.nc_whenSwipedInDirection(.Down) {[unowned self]  (gestureRecognizer) in
            self.lbState.text="Down"
        }

#Installation

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

platform :ios, '8.0'
use_frameworks!

pod 'NiceGesture'

###Manual Just copy the files which under NiceGesture folder to your project

###Carthage github "lacklock/NiceGesture"

#Contact

Weibo : @没故事的卓同学

License

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

You might also like...
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)

SwiftSoup is a pure Swift library, cross-platform (macOS, iOS, tvOS, watchOS and Linux!), for working with real-world HTML. It provides a very conveni

SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)

SwiftSoup is a pure Swift library, cross-platform (macOS, iOS, tvOS, watchOS and Linux!), for working with real-world HTML. It provides a very conveni

The best command-line tool to install and switch between multiple versions of Xcode.
The best command-line tool to install and switch between multiple versions of Xcode.

The best command-line tool to install and switch between multiple versions of Xcode.

The (second) best iOS app for GitHub.
The (second) best iOS app for GitHub.

GitHawk is the second-highest rated iOS app for GitHub. Features 0️⃣ Inbox Zero your notifications 📝 Comment even faster than on GitHub desktop 👍 Th

A Swift framework that wraps CoreData, hides context complexity, and helps facilitate best practices.
A Swift framework that wraps CoreData, hides context complexity, and helps facilitate best practices.

Cadmium is a Core Data framework for Swift that enforces best practices and raises exceptions for common Core Data pitfalls exactly where you make the

AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, best suited for authenticating users over the internet.

AnylineFaceAuthentication AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, be

BLE (Bluetooth LE) for U🎁 Bleu is the best in the Bluetooth library.
BLE (Bluetooth LE) for U🎁 Bleu is the best in the Bluetooth library.

Bleu Bleu is a Bluetooth library. Bleu is the easiest way to operate CoreBluetooth. Bleu is possible to operate by replacing Bluetooth 's Peripheral a

1st place and Best ML Hack for LEC Hacks 2021
1st place and Best ML Hack for LEC Hacks 2021

MoreCycle Anish Lakkapragada, Aayush Talluri, Soumik Sinha, and Abhishek Nambiar's project is found here. Idea Often times we don't know whether to re

Forecasts best times for using green electric energy in the UK
Forecasts best times for using green electric energy in the UK

Greencast - 24 Hour Green Energy Forecaster Greencast aims to help UK consumers optimise their use of green energy to minimise carbon dioxide emission

Best architecture for SwiftUI + CombineBest architecture for SwiftUI + Combine

Best architecture for SwiftUI + Combine The content of the presentation: First of the proposed architectures - MVP + C Second of the proposed architec

An advanced Swift (IOS Native) application that uses SOLID architectural principles, consumes a RESTFUL Service, downloads & images using best practices.
An advanced Swift (IOS Native) application that uses SOLID architectural principles, consumes a RESTFUL Service, downloads & images using best practices.

dog-playground-ios An advanced Swift (IOS Native) application that uses SOLID architectural principles, consumes a RESTFUL Service, downloads & im

A Swift framework that wraps CoreData, hides context complexity, and helps facilitate best practices.
A Swift framework that wraps CoreData, hides context complexity, and helps facilitate best practices.

Cadmium is a Core Data framework for Swift that enforces best practices and raises exceptions for common Core Data pitfalls exactly where you make them.

AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.
AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.

AuroraEditor AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.

The easiest way to use Bluetooth (BLE )in ios,even bady can use.
The easiest way to use Bluetooth (BLE )in ios,even bady can use.

The easiest way to use Bluetooth (BLE )in ios,even bady can use.

Since Facebook introduced reactions in 2016, it became a standard in several applications as a way for users to interact with content. ReactionButton is a control that allows developers to add this functionality to their apps in an easy way. GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way
GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way. This help

TopicEventBus is Easy to use, type safe way of implementing Publish–subscribe design pattern.
TopicEventBus is Easy to use, type safe way of implementing Publish–subscribe design pattern.

TopicEventBus Publish–subscribe design pattern implementation framework, with ability to publish events by topic. (NotificationCenter extended alterna

SwiftSocket library provides the easy way to use sockets on Apple platforms

SwiftSocket library provides as easy to use interface for socket based connections on server or client side. Supports both TCP and UDP sockets.

IGStoryButtonKit provides an easy-to-use button with rich animation and multiple way inspired by instagram story/stories.
IGStoryButtonKit provides an easy-to-use button with rich animation and multiple way inspired by instagram story/stories.

Introduction Have you ever seen UI like instagram story, haven't you? Actually, features like instagram story have been implemented in many applicatio

Comments
  • A good idea

    A good idea

    Originally intended going to write support oc,No longer need to use cumbersome selector reflection , but also solve the problem of separation of code. Refer to your ideas. Thanks

    opened by HectorLiuk 2
Releases(1.0.1)
Owner
Zhuo
iOS dev
Zhuo
The easiest way to show off your iOS taps and gestures for demos and videos.

It's ShowTime ?? Installation Swift Package Manager Cocoapods Manual Usage How it works Useful info Author License ShowTime is the simplest and best w

Kane Cheshire 459 Dec 27, 2022
Special way to work with gestures in iOS

At a Glance Sensitive is a library that simplifies work with gestures in iOS. Forget about target/action pattern of primitive UIGestureRecognizer. Wit

Igor M. 550 Dec 29, 2022
Special way to work with gestures in iOS

At a Glance Sensitive is a library that simplifies work with gestures in iOS. Forget about target/action pattern of primitive UIGestureRecognizer. Wit

Igor M. 550 Dec 29, 2022
Easy to use UITableViewCell implementing swiping to trigger actions.

SwipyCell Swipeable UITableViewCell inspired by the popular Mailbox App, implemented in Swift. Preview Exit Mode The .exit mode is the original behavi

Moritz Sternemann 249 Dec 5, 2022
The best way to use the Zora API in your Swift projects.

ZoraKit The best way to use the Zora API in your Swift projects. Disclaimer This is still very much a work in progress, and is really a proof-of-conce

MBLA 6 Sep 23, 2022
The best way to watch Put.io on iPhone and iPad

The best way to watch Put.io on iPhone and iPad

Fetch 89 Oct 27, 2022
Best way to dismiss Keyboard in a View Controller iOS (Swift)

Best way to dismiss Keyboard in a View Controller iOS (Swift) First way: Implement UITextFieldDelegate’s textFieldShouldReturn method and dismiss curr

null 0 Dec 18, 2021
Pager is the simplest and best way to implement sliding view controllers in Swift

Pager is the simplest and best way to implement sliding view controllers. Installation Drop in the Spring folder to your Xcode project. Or via CocoaPo

Lucas Oceano 234 Aug 5, 2022
CodeBucket is the best way to browse and maintain your Bitbucket repositories on any iPhone, iPod Touch, and iPad device!

CodeBucket Description CodeBucket is the best way to browse and maintain your Bitbucket repositories on any iPhone, iPod Touch, and iPad device! Keep

Dillon Buchanan 196 Dec 22, 2022
Smooch is the best way to have personal, rich conversations with people on your website or customers on any device

Smooch is the best way to have personal, rich conversations with people on your website or customers on any device. Our features, integrations and developer-friendly APIs empower companies to connect with their customers in a whole new way.

Zendesk 121 Aug 1, 2022