iOS 10 is required.
GTForceTouchGestureRecognizer is available through CocoaPods. To install it, simply add the following line to your Podfile:
Swift Package Manager
You can use The Swift Package Manager to install
GTForceTouchGestureRecognizer by adding the proper description to your
import PackageDescription let package = Package( name: "YOUR_PROJECT_NAME", targets: , dependencies: [ .Package(url: "https://github.com/neobeppe/GTForceTouchGestureRecognizer.git"), ] )
To use this library in your project manually you may:
- for Projects, just drag GTForceTouchGestureRecognizer.swift to the project tree
- for Workspaces, include the whole GTForceTouchGestureRecognizer.xcodeproj
You can simply instantiate an GTForceTouchGestureRecognizer and add it to a view.
let forceTouchGestureRecognizer = GTForceTouchGestureRecognizer(target: self, action: #selector(someFunction:)) view.addGestureRecognizer(forceTouchGestureRecognizer)
Optionally you can specify:
- force percentage
threshold, which is 0.75 by default
hardTriggerMinTimeminimum time after force touch has began
GTForceTouchGestureRecognizer is available under the MIT license. See the LICENSE file for more info.