Open bizibizi opened 7 years ago
and where should I place the code? I have class Animal, (Animal and _Animal). So, in Animal clasbut in what method? or after/before parsing data?
The value transformer(s) should be setup once before parsing. Usually application startup is a good place.
ok, and type in Model should be Transformable, right? but in that case I will need to convert property to needed type?
The type in the model doesn't need to be transformable. Please have a look at this document to get to know how Groot annotations work.
You can find an example of
ValueTransformer
in the unit tests: https://github.com/gonzalezreal/Groot/blob/master/GrootTests/SerializationTests.swift#L23And remember that the value transformer for a property is configured in the
.xcdatamodel
file: https://github.com/gonzalezreal/Groot/blob/master/GrootTests/Model.xcdatamodeld/Model.xcdatamodel/contents#L39