Latest 0.1
Homepage https://github.com/cemolcay/3DTouchHelper
License MIT
Platforms ios 9.0, requires ARC
Authors

Easy to use continuous 3D touch gesture recognizer.

Install

CocoaPods

use_frameworks
pod '3DTouchHelper'

Manual

Copy & paste 3DTouchHelper file into your project.

Requirements

  • Xcode 7.1
  • Swift 2.1
  • iOS9+
  • iDevice with 3DTouch screen

Usage

Call add3DTouchGestureRecognizer: function form your view or viewcontroller.

add3DTouchGestureRecognizer { (touchIndex, state, force, normalizedForce, forceValue, location) in
    print("touch (touchIndex) (state) (forceValue) value (normalizedForce) at (location)")
}

Handler

typealias TDTouchGestureRecognizerCallback = (
    touchIndex: Int,
    state: UIGestureRecognizerState,
    force: CGFloat,
    normalizedForce: CGFloat,
    touchForce: TDTouchForce,
    location: CGPoint) -> Void

TDTouchForce

An customisable enum for simplifying 3D touch force

enum TDTouchForce {
    case Low
    case Mid
    case High
}

TDTouchForceValue

A struct for customising TDTouchForce enum values

struct TDTouchForceValue {
    var Low: CGFloat
    var Mid: CGFloat
    var High: CGFloat
}

You can set your own values with add3DTouchGestureRecognizer:forceValue: function.

add3DTouchGestureRecognizer({ (touchIndex, state, force, normalizedForce, touchForce, location) -> Void in
    print("touch (touchIndex) (state) (forceValue) value (normalizedForce) at (location)")
}, forceValue: TDTouchForceValue(Low: 0.2, Mid: 0.6, High: 0.8))

Latest podspec

{
    "name": "3DTouchHelper",
    "version": "0.1",
    "summary": "Easy to use continuous 3D touch gesture recognizer.",
    "description": "3DTouchHelpern===nnEasy to use continuous 3D touch gesture recognizer.nnInstalln----nn### Cocoapodsnn``` rubynuse_frameworksnpod '3DTouchHelper'n```nn### ManualnnCopy & paste `3DTouchHelper` file into your project.nnUsagen----nnCall `add3DTouchGestureRecognizer:` function form your view or viewcontroller.nn``` swiftnadd3DTouchGestureRecognizer { (touchIndex, state, force, normalizedForce, forceValue, location) inn    print("touch (touchIndex) (state) (forceValue) value (normalizedForce) at (location)")n}n```nn### Handlernn``` swiftntypealias TDTouchGestureRecognizerCallback = (n    touchIndex: Int,n    state: UIGestureRecognizerState,n    force: CGFloat,n    normalizedForce: CGFloat,n    touchForce: TDTouchForce,n    location: CGPoint) -> Voidn```",
    "homepage": "https://github.com/cemolcay/3DTouchHelper",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "cemolcay": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/cemolcay/3DTouchHelper.git",
        "tag": "v0.1"
    },
    "source_files": "3DTouchHelper/3DTouchHelper/*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This