0

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 .

user3115014
  • 667
  • 1
  • 8
  • 23

2 Answers2

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:

  1. A bad UI experience for your users.
  2. An app that breaks on every OS update.
  3. 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