tristanhimmelman/AlamofireObjectMapper

Crash on OM 2.2.2

Closed this issue · 2 comments

OM 2.2.2 includes this commit, which assert if anyone try to invoke non-throwing version of map for ImmutableMappable casted to BaseMappable. It's really good idea, but AlamofireObjectMapper is not ready for such change. Generic method create generic ObjectMapperSerializer under the hood, which type constrained to BaseMappable. Later, during serializing method, serializer invokes map without try, which leads to crash.

I create a fix, but one question can't let me create a pr, what should i do with mapToObject for ImmutableMappable. My current fix allow to use instance, that conforming to ImmutableMappable protocol, and, if it implements mapping it will work, but mapping for ImmutableMappable seems lame and force developer to switch from let to var. Maybe mapping role should be reviewed for ImmutableMappable?

@haritowa I have released a new update that has proper support for ImmutableMappable. I think your problems should be resolved now. THanks