enum of string type vs struct with static constant

Viewed 1911

It seems like when the need to use enum (of string type) arise, it can also be achieved using struct using static fields.

e.g.

enum Test: String {
  case TestCase1
  case TestCase2
  case TestCase3
}

or

struct Test {
  static let TestCase1 = "TestCase1"
  static let TestCase2 = "TestCase2"
  static let TestCase3 = "TestCase3"
}

When is the enum approach preferred over the other, or vice versa?

2 Answers
Related