CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

OpenMultitouchSupport 1.1

OpenMultitouchSupport 1.1

Maintained by Takuto Nakamura.



OpenMultitouchSupport

This enables you easily to observe global multitouch events on the trackpad (Built-In only).
I created this framework to make MultitouchSupport.framework (Private Framework) easy to use.
This framework refers to M5MultitouchSupport.framework very much. This project includes a demo.

References

Installation

CocoaPods

pod 'OpenMultitouchSupport'

Carthage

github "Kyome22/OpenMultitouchSupport"

Usage (Swift)

  • Prepare manager
import OpenMultitouchSupport

let manager = OpenMTManager.shared()
  • Register listener
let listener = manager?.addListener(withTarget: self, selector: #selector(process))

@objc func process(_ event: OpenMTEvent) {
	guard let touches = event.touches as NSArray as? [OpenMTTouch] else { return }
	// ・・・
}
  • Remove listener
manager?.remove(listener)
  • Toggle listening
listener.listening = [true / false]
  • The data you can get are as follows:
OpenMTTouch
.posX // Float
.posY // Float
.total // Float, total value of capacitance 
.pressure // Float
.majorAxis // Float
.minorAxis // Float
.angle // Float
.velX // Float
.velY // Float
.density // Float, area density of capacitance
.state // OpenMTState

OpenMTState
.notTouching
.starting
.hovering
.making
.touching
.breaking
.lingering
.leaving