Saving files from iOS app running on M1 while unit testing

I want to unit test my iOS app running on my M1 machine. The tests generate snapshots and I'd like to be able to save them on the host machine running the tests but I can't seem to come up with a good way to do it.

I tried saving to the sandbox and using a post action in Xcode to just copy the files from the sandbox to where I need them to be. Unfortunately I have no idea how to reliably retrieve the sandbox url from the iOS app. Instead of the bundle id it seems to use some random UUID for the sandbox identifier (e.g. /Users/[USERNAME]/Library/Containers/D354FAB7-AEA9-4351-BE46-648BF0D13357/Data/Documents/) and I have no idea where that's coming from.

I also can't seem to opt out of the sandbox (which I figured but still).

I can't use NSOpenPanel or any user-driven interaction for getting a system shared folder to save anything to since it's all supposed to be automated.

Any ideas of what I'm missing or what else I might try?

Saving files from iOS app running on M1 while unit testing
 
 
Q