Search code examples
iosxcodemetal

Xcode: how can I enable Metal API Validation for a tests target?


It's easy to enable Metal API validation when running my app via Edit Scheme -> Run -> Options -> Metal API Validation: Xcode logging: "Metal API Validation Enabled"

But what about for testing? There is no such setting in Edit Scheme -> Test, and validation appears to be off when I run tests.


Solution

  • Set the METAL_DEVICE_WRAPPER_TYPE environment variable to 1 in Edit Scheme -> Test -> Arguments.