I have been asked to develop an app that will record and later \"play back\" touches and gestures onto another app running in the foreground.
From my experience and
Nope not possible, no way no how, dont even try.
Expanded answer, if this runs on a jailbroken phone.......
Yes.... but good luck,
check Saurik's Veency code for this sort of functionality, it would have to be refactored signifcantly but basically it allows for virtualization of taps.
https://github.com/iceNuts/TouchTest
http://gitweb.saurik.com/veency.git
It's actually possible with facebook's idb: https://github.com/facebook/idb/
As it stated: Remote Automation. idb has a “companion” that runs on macOS and a python client and cli that runs anywhere. This enables scenarios such as a “Device Lab” within a Data Center or fanning out commands to large numbers of iOS Simulators.
As facebook stop support on WebDriverAgent, it's the best option we have right now
if you want to access another application in your iPhone ,you can set the url scheme parameter and so on.You can add callback in your url,then you can return back your application.