MaxHasADHD / TraktKit

Swift wrapper for Trakt.tv API.
MIT License
112 stars 37 forks source link

Switch to Codable for request body #50

Open MaxHasADHD opened 4 years ago

MaxHasADHD commented 4 years ago

Currently the framework is accepting dictionaries and converting them to data itself using JSONSerialization. On my end I'm seeing crashes using this method, and would like to switch to using encodable. I'm still thinking of the best way to make this transition though and want to make it easy for everyone, including myself for my apps that use the framework. I want to keep the benefit of the framework using parameters so you don't need to lookup the body format yourself. An idea I'm going over is finding a way to enforce the codable objects passed in to encode the Trakt Id, and having a Body object that will piece together "movies": { ... }, "shows": { ... }, etc. Let me know if any of you have ideas that can make this 1) Painless to transition 2) Still makes this framework simple to use