Skip to content

Hijack I/O Kit to dispatch touch events to the iOS digitizer

License

Notifications You must be signed in to change notification settings

Darwinist/Digitizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digitizer

Hijack I/O Kit to simulate touches events on the iOS digitizer. Useful in UI testing and automation.

Features

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.

App Store Rejection

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.