So after a few days with no answer I set up some experiments. By the way, these tests are run on the simulator and not on an actual device, but I think it would be the same.
First test, I set a breakpoint in the debugger on touchesBegan
and looked at the stack trace. It appears that touchesBegan
is called from the first thread and from the main
loop - the same place as the rest of the logic, so this looks good for a singe-threaded approach.
Second test, I overrode the various methods in the scene mentioned in the Advanced Scene Processing link above and added print statements to show th name of each function called. Then I added a print statement to the touchesBegan
method.
On running the app, the output was:
update
didEvaluateActions
didSimulatePhysics
didApplyConstraints
didFinishUpdate
touchesBegan in scene
update
didEvaluateActions
didSimulatePhysics
didApplyConstraints
didFinishUpdate
update
and this pattern was repeated whenever I clicked.
No amount of clicking gave me anything else than touchesBegan
being called between the didFinishUpdate
(that is, the end of one cycle) and the update
(the beginning of the next).
Conclusion: touches processing happens in the main loop before the update method is called. It is therefore not necessary to synchronise resources between the two methods.