I'd like to create default implementation for convenience protocol function that just calls another protocol function, but can't figure out what's wrong with the code:
protocol RequestManagerProtocol {
func perform<T: Decodable>(_ request: RequestProtocol) async throws -> (T, Int)
func perform<T: Decodable>(_ request: RequestProtocol) async throws -> T // Convenience function
}
extension RequestManagerProtocol {
func perform<T: Decodable>(_ request: RequestProtocol) async throws -> T {
let (obj, _) = perform<T>(request) // Error: Cannot specialize a non-generic definition
return obj
}
}