@concurrent in protocol declaration

protocol PacakgesUseCaseProtocol {
    @concurrent func getPlans() async throws
}

if I added the @concurrent to the protocol declaration do I need to add it also in the implementation ?

    @concurrent func getPlans() async throws {}
2 Likes

Please correct me if I am wrong but I believe @concurrent (and nonisolated(nonsending) respectively) are actually inferred from protocol requirements by default, so an implementation of a protocol requirement will 'inherit' @concurrent.

The exception I am aware of is when using @MainActor default isolation in which case the default isolation takes precedence and the implementation of protocol requirements defaults to @MainActor isolation.

2 Likes