Swift

Swift

Made by DeepSource

String enum values can be omitted when they are equal to the enum case name SW-R1031

Anti-pattern
Minor

When defining enum cases in Swift, it is unnecessary and redundant to explicitly specify the enum values when they are same as the enum case name.

Redundantly specifying the enum values can lead to code duplication and increase the likelihood of mistakes.

Bad Practice

enum Numbers: String {
  case one = "one"
  case two = "two"
}

Recommended

enum Numbers: String {
  case one
  case two
}