Hijack I/O Kit to simulate touches events on the iOS digitizer. Useful in UI testing and automation.
Send touch events to UIView
by reference. Supports single-touch, multitouch, and long press.
#import <Digitizer/Digitizer.h>
...
UIView *myView = [[UIView alloc] initWithFrame: CGRectMake(...)];
NSArray *points = @[
[NSValue valueWithCGPoint:CGPointMake(0, 0)],
[NSValue valueWithCGPoint:CGPointMake(myView.center.x, myView.center.y)]
];
// Simulate touches
[myView simulateMultiTouchAtPoints:points holdDuration:2.0];
Note: All touch simulations are serial actions and do not occur on a background thread. Simulating a touch will occur immediately and can be seen by placing a breakpoint on the touchesBegan:withEvent: function of the view.
Digitizer should not be included in App Store builds.
Digitizer uses IOHIDFamily classes, part of the I/O Kit framework. Although I/O Kit is a public framework, Apple states any apps using it will be rejected from the App Store.