Touchr
Handle Multitouchevents the easy way
Touchr helps you with handling Multitouch-Events.
📱 Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
🔧 How to use
Touchr is super easy to use.
Just create a Touchr Object and declare it as your nextResponder inside your View or ViewController. You can currently just subscribe using Rx but i will implement oldschool delegate methods soon.
Two Types of events will be fired.
- releaseOfTouch(touch: TouchDescriptor)
- touch(touches: Set)
- TouchDescriptor (when touch started, which finger and actual touch object)
class MultiTouchViewController: UIViewController {
lazy var touchr: Touchr = {
var touchr = Touchr(maximumNumberOfSimultaneousTouches: 3)
return touchr
}()
override var next: UIResponder? {
return touchR
}
override func viewDidLoad() {
super.viewDidLoad()
touchr.touchStream.subscribe(onNext: { event in
switch event {
case .releaseOfTouch(let touchDescriptor):
// Handle release of Fingers over here
case .touch(let lastTouches):
// Handle touches over here
}
}).disposed(by: bag)
}
}
That's it. That's lit.
✅ Requirements
Deployment target of your App is >= iOS 9.1
📲 Installation
Touchr is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Touchr"
🤖 Author
Sebastian Boldt, http://sebastianboldt.com
📄 License
Touchr is available under the MIT license. See the LICENSE file for more info.