How do I get the count of a Swift enum?

How can I determine the number of cases in a Swift enum?

(I would like to avoid manually enumerating through all the values, or using the old “enum_count trick” if possible.)

26 Answers
26

Leave a Comment