Latest 1.0.0
Homepage https://github.com/pixel-ink/PIForceTouch
License MIT
Platforms ios 8.0
Authors

Force Touch for iOS (swift)

NOTICE: Try in your device, not simulator.

PIForceTouch
PIForceTouch
PIForceTouch
PIForceTouch


demo

demo


demo

  • cd PIForceTouchDemo
  • pod install
  • open PIForceTouch.xcworkspace

install

  • manually
    • add PIForceTouchView.swift into your project
  • cocoapods
    • add " pod ‘PIForceTouch’, ‘1.0.0’ " into your Podfile

usage

  • add " import PIForceTouch " into your code
  • add PIForchTouchView into your UIViewController
  • set delegate your view. (PIForceTouchViewDelegate)
  • write callback
@objc protocol PIForceTouchViewDelegate {

  //like UIButton's Delegate
  optional func touchUpInside(touch: UITouch)
  optional func forceTouchUpInside(touch: UITouch)

  //like UIView's Delegate
  optional func beganTouch(touch: UITouch)
  optional func beganForceTouch(touch: UITouch)
  optional func endedAllTouch(touch: UITouch)
  optional func cancelledAllTouch(touch: UITouch)

}
  • example
import UIKit
import PIForceTouch

class ViewController: UIViewController, PIForceTouchViewDelegate {

  @IBOutlet var piftView: PIForceTouchView!

  override func viewDidLoad() {
    super.viewDidLoad()
    piftView.delegate = self
  }

  func forceTouchUpInside(touch: UITouch) {
    println("ForceTouched")
  }

}

Latest podspec

{
    "name": "PIForceTouch",
    "version": "1.0.0",
    "summary": "Force Touch for iOS (swift)",
    "homepage": "https://github.com/pixel-ink/PIForceTouch",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "pixelink": "https://github.com/pixel-ink"
    },
    "social_media_url": "http://twitter.com/pixelink_jp",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/pixel-ink/PIForceTouch.git",
        "tag": "1.0.0"
    },
    "source_files": "**/PIForceTouchView.swift"
}

Pin It on Pinterest

Share This