It seems that the Error type in Swift provides only one property, localizedDescription. My app will be running on machines set to other languages than English. I would like to write error reports (for my perusal, not the user’s) in English: I need the non-localized description of the error. How can I get it?
enum SomeError: String, Error, CustomDebugStringConvertible {
var debugDescription: String {
self.rawValue
}
case error1
case error2
}
Then just
print(SomeError.error1.debugDescription)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With