A migration is probably the best solution but if you don't want to do that you could use a custom decoding for the enum
extension Kind {
init(from decoder: any Decoder) throws {
let container = try decoder.singleValueContainer()
let rawValue = try container.decode(String.self)
if let kind = Kind(rawValue: rawValue) {
self = kind
} else {
let oldValue = rawValue.capitalized // <-- You might need to adjust this depending on how the rest of the enum looks.
guard let kind = Kind(rawValue: oldValue) else {
throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: [], debugDescription: "Unknow kind: \(oldValue)"))
}
self = kind
}
}
}
Note that this will fix the value when read from storage but to actually store the new value, "Credit", each objects will need to be saved until it's persisted.