Latest 0.0.1
Homepage https://github.com/getaaron/HapticTouchGestureRecognizer
License MIT
Platforms ios 12.0, requires ARC
Authors

”iPhone Xʀ has a new feature we call Haptic Touch. So to get to the camera from the home screen, we just press on it. You feel a haptic tap, and you’re taken right to the camera.“

Phil Schiller

A gesture recognizer for iPhone Xʀ’s Haptic Touch™ feature

  • Works just like a UILongPressGestureRecognizer
  • Plays haptic feedback just like iPhone Xʀ’s home screen

Installation

In your Podfile:

pod 'HapticTouchGestureRecognizer'

Then run pod install.

Usage

In your View Controller:

override func viewDidLoad() {
    super.viewDidLoad()

    let hapticTouchGestureRecognizer = HapticTouchGestureRecognizer(target: self,
                                                                    action: #selector(detected(gestureRecognizer:)))
    view.addGestureRecognizer(hapticTouchGestureRecognizer)
}

@objc func detected(gestureRecognizer: HapticTouchGestureRecognizer) {
    guard gestureRecognizer.state == .began else { return }
    // handle long press here
    // haptic feedback plays automatically
}

Latest podspec

{
    "name": "HapticTouchGestureRecognizer",
    "version": "0.0.1",
    "summary": "Haptic Touch gesture recognizer for iPhone Xu0280.",
    "description": "Haptic Touch gesture recognizer for iPhone Xu0280 (iPhone XR),nwhich doesn't support 3D Touch or force touch APIs.",
    "homepage": "https://github.com/getaaron/HapticTouchGestureRecognizer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Aaron Brager": "[email protected]"
    },
    "social_media_url": "https://twitter.com/getaaron",
    "platforms": {
        "ios": "12.0"
    },
    "source": {
        "git": "https://github.com/getaaron/HapticTouchGestureRecognizer.git",
        "tag": "0.0.1"
    },
    "swift_version": "4.2",
    "source_files": "*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This