Printing all cases in an enum is super simple!
Now I need to print all cases in the nested enum. My enum is like:
enum OuterEnum: String, CaseIterable {
case a = "A"
case b = "B"
enum InnerEnum: String, CaseIterable {
case c = "C"
}
}
If I try to print all elements by allCases
property, only a & b are getting printed. But, my expectation is,
printEnumCases(OuterEnum.self)
should print all the cases like
A
B
C
Can someone help in this?
Additional question: Also, I want to know about the difference between allCases
& AllCases
properties of an enum.
Thanks!!