Giter VIP home page Giter VIP logo

3dtouchhelper's Introduction

3DTouchHelper

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))

3dtouchhelper's People

Contributors

cemolcay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.