Cheat UIGestureRecognizer for testing
Objective-C C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


iOS gestures are source of headache for programmers. From the point of view of automated integration testing, they are evil since it is difficult to simulate from programs.

VirtualGesture simulate gestures by directoly invoking actions associated with UIGestureRecognizers. If you are using built-in gesture recognizers -- UISwipeGestureRecognizer, UILongPressGestureRecognizer, etc --, you can use VirtualGesture to simulate user's multi touch gestures.


// Long press gesture
[view recognizeLongPress];

// Swipe gesture
[view recognizeSwipe:UISwipeGestureRecognizerDirectionRight];

// Pinch gesture
[view recognizePinch:0.2];


  • Simple API. Instead of configureing every touches of every frame and every fingers, just say swipe or something like that.
  • Timing matters. Some gesture recognizers have velocity property. It is difficult to set up such time dependent properties by sending touch events directory. VirtualGesture can do that. It just setup gesture recognizer's properties, and invoke an action associated with it.


  • Not simulating user input.
  • Customized gesture recognizers are not supported. For example, UIWebView and MKMapView do not respond to virtual pinch gestures. They do not use UIPinchGestureRecognizer but a customized, private gesture recognizer.
  • It is not clear, whether it works or not for complex usage of multiple gesture recognizers.


Written by Soutaro Matsumoto. (matsumoto at soutaro dot com)

Released under the MIT License: