I am using this function
public mutating func encodeIfPresent<T>(_ value: T?, forKey key: KeyedEncodingContainer.Key) throws where T : Encodable
to encode a entity
But my entity contains a dictionary which I also want to use that function to encode
encodeIfPresent
accept a generic value that conforms to Encodable protocol.
How can I declare my dictionary like var customFields: [String: Encodable.Type]?
or var customFields: [String: T] where T : Encodable
to allow the values of the dictionary to be passed to that function?
note: the two methods are just examples which I tried but failed.