Skip to content

Instantly share code, notes, and snippets.

@daoseng33
Last active Nov 18, 2018
Embed
What would you like to do?
enum SectionType: Int {
case header = 0
case list
static let count: Int = {
var max: Int = 0
while let _ = SectionType(rawValue: max) { max += 1 }
return max
}()
}
print(SectionType.count) // 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment