Using `ProcessInfo` to customise a Swift Macro output

I’ve been writing a macro for snapshot testing views found here:

I have a use case where I want users to be able to set a default value in one place to select their diffTool of choice which means:

  • a user could have a personal preference despite many people working on the same project
  • potentially a lot of code changes if placed in each @SnapshotSuite every time

Given these two constraints my initial thinking is for users to be able to set their personal preference to pass in the scheme’s environment variables, but a quick test shows ProcessInfo isn’t populated when the macro code is run (I’m assuming for security reasons) when doing code gen.

If this is the case, I’m just trying to think of alternatives where a user can set their own personal preference and the generated macro code can respect that, without them manually updating every place where they use the macro, which could potentially be hundreds or even thousands of places.

Is there any ideas? Or is the code gen for macros entirely locked down meaning the only way to set these is explicitly in place?