Questions tagged [customstringconvertible]

16 questions
-1
votes
3 answers

How to get the default string representation of a Swift enum for further customization

Start with an enum in Swift: enum UnitCode:UInt { case Unknown = 0 case Hz = 1 case GPM = 2 case M3_Hour = 3 case mA = 4 case PSI = 5 case Bar = 6 } For most of those, an expression like: let text = "\(aUnitCode)" will…
Travis Griggs
  • 21,522
  • 19
  • 91
  • 167
1
2