netable
netable copied to clipboard
Revisit parameter encoding when Swift supports encode to dictionary
When encoding GET parameters, we're currently encoding the params to JSON, the decoding to [String: Any]. This is far from ideal but at the time seems like the simplest way.
If Swift does add support for encoding directly to Dictionary we should jump right on that.
@brendanlensink Swift 5.6 includes https://github.com/apple/swift-evolution/blob/main/proposals/0320-codingkeyrepresentable.md
I am wondering if that's what we're looking for here?
This is interesting, but AFAICT would only be available in iOS 15.4 and above. This is a little tricky, since I think it's unlikely any kind of backwards compatible solution will be introduced in the future.
I think we've got a feasible couple options right now:
- Do nothing. This hasn't really caused any problems yet, even though it's not ideal.
- Add support for CodingKeyRepresentable where available, leave the old solution in where it's not
- Drag our feet a little, eventually bump the minimum app version up and remove the old solution.
I'm sort of inclined to just go with option 1 for now, but we can probably keep this issue open for future consideration.
Yeah option 3 sort of includes option 1, and the timing for option 3 is probably some time next year, when iOS 16 reaches 70% adoption rate. That could be a good time to implement CodingKeyRepresentable
to be even safer, should no urgent needs arise by then.