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
// Protocol for a type that supports a fromRaw(Int) conversion | |
// (such as "enum Foo: Int { ... }") | |
protocol ConvertibleFromRawInt { | |
class func fromRaw(raw: Int) -> Self? | |
} | |
// Note: Tried to use Swift's standard RawRepresentable protocol rather | |
// than ConvertibleFromRawInt, but couldn't get it to compile. | |
// Don't know whether it is a Swift bug or something I was doing wrong. |