TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2015 |
SPMSupports SPM | ✗ |
Maintained by Ashley Mills.
UIGestureRecognizer Swift subclass enabling 3D Touch
Just drop the ForceTouchGestureRecognizer.swift file into your project. That’s it!
override func viewDidLoad() {
super.viewDidLoad()
let forceTouchGesture = ForceTouchGestureRecognizer(target: self, action: "pressView:")
forceTouchGesture.minimumValue = 0.1 // Minimum force value before touch is recognised
forceTouchGesture.tolerance = 0.2 // Allows the pressure to be lifted slightly without the gesture ending
view.addGestureRecognizer(forceTouchGesture)
}
func pressView(gesture: ForceTouchGestureRecognizer) {
print("force: \(gesture.forceValue)") // forceVouch is CGFloat between 0 & 1
}
Got a bug fix, or a new feature? Create a pull request and go for it!
Cheers, Ash