I want to create a fake touch in iOS ViewController programmatically by giving the co-ordinates as input it should work like a manual touch please guide me in achieving that .
Asked
Active
Viewed 40 times
2 Answers
1
That can be possible, Once I found something that does the same as you wanted. But I would like you to read these line that the author wrote a the beginning of that post:
The content of this post is for debugging and testing only. Do not submit this code in an application to the App Store. Doing so will likely result in:
- A bad UI experience for your users.
- An app that breaks on every OS update.
- Rejection of your application.
Here is the link.

Rashad
- 11,057
- 4
- 45
- 73
0
I can only imagine that you need such a function for testing the user interface. If this is the case, you should consider using Xcode's Automation instrument (Product -> Profile).
This instrument allows you e.g. to simulate touches to interface elements like buttons.
You could execute instructions like
UIATarget.localTarget().frontMostApp().navigationBar().buttons()["Add"].tap();

Reinhard Männer
- 14,022
- 5
- 54
- 116