I want to get tap gesture
recogniser attached to an UIView
and trigger it programatically. I successfully found a way to find tap gesture recogniser of an UIView
. But now I don't know how to trigger it programatically. I am working on app crawler
. So if I have a source code of a ViewController then, my crawler will start crawling find all the subviews
of ViewController
. Also the crawler will find gesture
attached to the subviews
. And trigger tap gesture
.
Note : I know how to attach gesture recogniser to UIView
and trigger it. But in my case I wanted to automate the clicking process of an app. Just consider as I want to runtime find tap gesture recogniser of UIView
and trigger it.
I solved this by creating fake touches. Triggering gesture was not possible as gestures does not expose its action and selector. But as I have UIView
on which I want to tap. I can create a fake touch on that UIView
. This fake touch will automatically trigger the tap gesture. This link was very helpful for this.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments