Changing the description of a metatype?

I have a class for which I'd like to change the output of String(describing: MyClass.self). It currently returns "MyPackage.MyClass" and I'd like it to return any arbitraty string.

Is it currently possible in Swift?

My use case is to manipulate this behaviour in XCTest for dynamically generated test cases, I'd like them to have a proper name (rewrite Package.TestRunner<TestCase>/testFunction to Package.TestCase/testFunction).

Thanks!

2 Likes