How do I implement a Swift protocol with a generic constrained type property?
I would like to have a protocol that looks something like this: protocol ReturnType { var returnType: ImmutableMappable.Type { get } } The part of the enum implementing the protocol: extension ShimEndPoint: ReturnType { var returnType: ImmutableMappable.Type { switch self { case .deAuthorize(_, _): return EmptyResponse.self case .authorize(_, _): return AuthorizeResponse.self case .step(_, _, _, _): return StepResponse.self } } } EmptyResponse, AuthorizeResponse and StepResponse all implement ImmutableMappable. Now I would like to use the "returnType" property in a function call: return Shim