I have a JsonSerializer protocol which should support JsonSerialization (Swift < 4.0) and JSONEncoder/ JSONDecoder (Swift >= 4.0).
In protocol, there's a function called toDict<T>(withNil value: String) -> [String : T]?. However, if I'd like to use JsonDecoder here, I have to make T: Decodable which doesn't make sense here since JsonSerialization doesn't require T to conform to Decodable. Is there any better way to solve this kind of compile error? Thanks