I don't think there is a way to influence the compiler-generated RawRepresentable conformance, but depending on your use case, you may be able to deal with this at some other layer.
I have e.g. some JSON-data that I want to decode from Pascal casing, so I use the compiler generated raw values, and computer generated coding keys, and use a key decoding strategy to convert the keys while decoding:
extension JSONDecoder.KeyDecodingStrategy {
static let convertFromPascalCase = custom { keyPath in
struct AnyKey: CodingKey {
var stringValue: String
var intValue: Int?
init?(stringValue: String) { self.stringValue = stringValue }
init?(intValue: Int) { self.stringValue = ""; self.intValue = intValue }
}
let upperCasedKey = keyPath.last!.stringValue
return AnyKey(stringValue: upperCasedKey.first!.lowercased() + upperCasedKey.dropFirst())!
}
}
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromPascalCase
let data = Data(...)
let model = try decoder.decode(MyModel.self, from: data)