[InstantSearch-iOS] Set decoding strategy to HitsInteractor

I want my Codable model variable names to be in camel case however when I use it with HitsInteractor it’s on snake case by default

// JSON
// { "first_name": "sample" }

// This works because the property name is on snake case similar with json
struct Person: Codable  {
 var first_name
}

// This doesn't work unless I add CodingKeys
struct Person: Codable  {
   var firstName

   private enum CodingKeys: String, CodingKey {
      case firstName = "first_name"
   }

// Usage
var personInteractor: HitsInteractor<Hit<Person>> 
}

Is there a way I could set the HitsInteractor 's JsonDecoder.keyDecodingStrategy so I don’t need to add CodingKeys per model? If yes, how and where? Can’t seem to find the api for this. Thanks!

Hi @Tef ,

There’s currently no way to configure the JsonDecoder for HitsInteractor. We’ve added it as a feature request for the library.

1 Like