-
-
Save Arcovv/fd49b114357a87ef42c954a7bd6ddd75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension RawRepresentable where RawValue == Int { | |
static var itemsCount: Int { | |
var index = 0 | |
while Self(rawValue: index) != nil { index += 1 } | |
return index | |
} | |
static var items: [Self] { | |
var items: [Self] = [] | |
var index = 0 | |
while let item = Self(rawValue: index) { | |
items.append(item) | |
index += 1 | |
} | |
return items | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment