wvteijlingen / Spine

A Swift library for working with JSON:API APIs. It supports mapping to custom model classes, fetching, advanced querying, linking and persisting.
MIT License
266 stars 109 forks source link

Can't explicitly define value formatter for attribute #138

Open markst opened 7 years ago

markst commented 7 years ago

ValueFormatterRegistry will loop through all unformatters till there is a successful unformatted value. Which means I can't explicitly define what formatter to use for my attribute - resulting in an incorrect formatter being used for my value.

wvteijlingen commented 7 years ago

👍 We should have an option to do this.

markst commented 7 years ago

What do you recon @wvteijlingen. Add an extra property on Field of a type ValueFormatter? It would be good to be able to reuse formatters in the formatters pool, but there may also be instances when we do not wish to add the formatter to the pool.

wvteijlingen commented 7 years ago

Do you have a specific use case where the current system breaks down? I rather not add a formatter property to Field, because that would mean more configuration. I think for now if you want to use a different formatter, you need to create a different Field subclass.