Member-only story
5 Powerful Ways to Leverage Enums in Swift
This is except for enums that are basic used.

Swift enumerations (enums) are a powerful feature that allows you to define a common type for a group of related values. Unlike enums in other programming languages, Swift enums are first-class types that can include sophisticated functionality.
1. Custom Enum Raw
I often use enums because they help keep my code organized. I use them to compare data types instead of using strings, which can be messy. In this example, I created an enum for my project because the API response data contains different keys that are also used as titles. This allows me to handle various types more effectively.”
Here, I also added functionality to capitalize the first letter.
enum IndicatorName: String {
case withNotation = "with notation"
case noNotation = "no notation"
case sector = "sector"
case companyQuality = "Company Quality"
var capitalized: String {
return self.rawValue.capitalized
}
var lowercased: String {
return self.rawValue.lowercased()
}
var uppercased: String {
return self.rawValue.uppercased()
}
var firstLetter: String {
return self.rawValue.capitalizeFirstLetterOnly()
}
}
public extension String {
internal func…