1

Is there a way to associate a tuple to a enum?

For example:

typealias MyTuple = (Int, String)

enum A: MyTuple {
   case .Foo = (1, "Bazz")
}

I get the error 'A does not conform RawRepresentable'

Cœur
  • 37,241
  • 25
  • 195
  • 267
Godfather
  • 4,040
  • 6
  • 43
  • 70
  • 1
    From the Swift reference: *"Raw values can be strings, characters, or any of the integer or floating-point number types. ..."* – Martin R Nov 24 '16 at 15:18
  • Although asking about associating a tuple to an enum, another approach to solving the underlying problem the OP is trying to solve could be to use nested enums. – paulvs Nov 24 '16 at 15:53

0 Answers0