Xcode compile error "Expected a type" shows only when running tests

18 views Asked by At

I have added a test case to an existing (mixed Objective-C / Swift) project. Building and running the project on simulator or devices is no problem. However, when trying to run the test, I get the error message Expected a type on the line + (UIUserInterfaceStyle)currentUIStyle;

enter image description here

Since the same code runs without any problem on device / simulator, there is no syntax error close to this line. Moving the line within the code shows the same result. The compiler complains about this specific point in code.

Any ideas what could cause this problem and how to solve it?

Xcode 15.2 on macOS 14.0

Standard procedures like cleaning the build folder, deleting derived data, restarting Xcode and the Mac do not solve the problem.

Are there any limitation on available types/frameworks, etc. while running tests?

0

There are 0 answers