I'm using Xcode 26.1 and encountering a Swift concurrency warning related to an enum's protocol conformance.
I have the following APIEndpoint protocol and the Endpoint enum that conforms to it:
protocol APIEndpoint {
var baseURL: URL { get }
var path: String { get }
var method: HTTPMethod { get }
var headers: [String: String]? { get }
var body: Data? { get }
}
enum Endpoint: APIEndpoint {
// ... implementation details ...
}
I also have a generic URLSessionAPIClient<EndpointType: APIEndpoint> class.
When initializing this client in a unit test class context: apiClient = URLSessionAPIClient<Endpoint>(session: MockURLSession())
I receive the warning: **Main actor-isolated conformance of 'Endpoint' to 'APIEndpoint' cannot be used in nonisolated context; this is an error in the Swift 6 language mode
**
My question is: Why is Endpoint's conformance to APIEndpoint being considered MainActor-isolated, and what is the proper fix? I'd prefer a solution that avoids marking the entire unit test class with @MainActor or adding nonisolated to the Endpoint enum itself, as these seem like workarounds.