Answers to Swift equivalent of Enum.ordinal() in Java ( 1 )

  1. 2017-08-17 17:08

    You can use rawValue to access the ordinal value of an enum marked with Int.

    enum SomeEnum: Int {
        case first
        case second
        case third
        case fourth
    }
    
    print(SomeEnum.third.rawValue) //2
    

Leave a reply to - Swift equivalent of Enum.ordinal() in Java

◀ Go back