Skip to content

djnivek/SwiftyGestureRecognizer

Repository files navigation

SwiftyGestureRecognizer

Platforms Swift version CocoaPods

This project is already available but needs a lot of functionalities

WT# is SwiftyGestureRecognizer ?

Modern Swift API for UIGestureRecognizer

SwiftyGestureRecognizer makes Gesture Recognizer API easy to use in the simplest way.

🚧🚧 Project is not completely set. CocoaPods is not available for now. 🚧🚧

Usage

Initialization

import SwiftyGestureRecognizer

Install

You will need to attach the gesture on the UIView you want by calling the constructor init(for: UIView)

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    GestureRecognizer.get(contactLabel).pressed { (label, recognizer) in
        label.textColor = .red
    }
}

Chainable Gestures

You can chain every gestures

GestureRecognizer.get(contactLabel).rotatable().pannable().pressed { (label, recognizer) in
    label.textColor = .red
}

Uninstall

Do no miss to uninstall before the view will disappear by calling the class function uninstallAll()

override func viewWillDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)
    GestureRecognizer.uninstallAll() // uninstall all recognizers
}

And after ?

Remaining work

SwiftyGestureRecognizer is made to ensure the complete UIGestureRecognizer API, we need to take care about all methods.

Expected work:

  • UISwipeGestureRecognizer
  • UIScreenEdgePanGestureRecognizer
  • UILongPressGestureRecognizer

Communications

  • If you'd like to ask a general question, use Stack Overflow.
  • If you found a bug, and can provide steps to reliably reproduce it, open an issue.
  • If you want to contribute, submit a pull request.

Licence

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

About

Modern Swift API for UIGestureRecognizer

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published