Is there a convenient way to exclude files based on an OS filter?

I have an existing app which I converted to Vision OS. The iOS app is using package dependencies which are not compatible with VisionOS. I filtered only iOS from the package under Frameworks, Libraries.. for the target. And then I used #if(os) to exclude the entire content of the swift file that is using the package.

Is there a convenient way to exclude entire files based on OS in the same sense that Package has an OS filter?

File a feature request via the feedback tool

Is there a convenient way to exclude files based on an OS filter?
 
 
Q