protocol P {} struct S: P {} struct V { static let value = V() } class Service { func perform() { let s = S() let _: Any = encodeResponse(s) } private func encodeResponse(_ s: S, indent: V = V.value) -> [String: Any] { [:] } private func encodeResponse<T: P>(_ response: T) -> Any { 0 } } let s = Service() s.perform()
protocol P {} struct S: P {} struct V { static let value = V() } class Service { func perform() { let s = S() let _: Any = encodeResponse(s) } private func encodeResponse(_ s: S, indent: V = V.value) -> [String: Any] { [:] } private func encodeResponse<T: P>(_ response: T) -> Any { 0 } } let s = Service() s.perform()