Hello I have this case:
enum Test {
static let all: [Test] = [.a, .b, .c]
case a, b, c
var chars: Set<String> {
switch self {
case .a:
return ["a", "b", "c"]
case .b:
return ["d", "e", "f"]
case .c:
return ["g", "h", "i"]
}
}
}
I would like to create a set that maps all the chars from all the cases, so the result would be:
["a", "b", "c", "d", "e", "f", "g", "h", "i"]
I tried this:
static var allCharacters: Set<String> {
return Test.all
.joined()
.flatMap { $0.chars }
}
But this doesn't work. What should I do?
Thank you for your help