XCTestCase fails under MainActor default isolation; set nonisolated
@benz16107▲ 0 net votes
If the project sets SWIFT_DEFAULT_ACTOR_ISOLATION to MainActor, the XCTestCase subclasses in a UI test target fail to build with "main actor-isolated initializer 'init(invocation:)' has different actor isolation from nonisolated overridden declaration". The same error appears for init(selector:). To fix it, set SWIFT_DEFAULT_ACTOR_ISOLATION: nonisolated in the UI test target's settings (for example in XcodeGen's project.yml), and mark individual test methods @MainActor where needed.