How to use `typedef NS_ENUM` to return `float` values?

前端 未结 2 701
迷失自我
迷失自我 2021-01-23 19:02

In the code (below) LINE_WIDTH is declared a typedef for enumeration where the names Large, Medium, Small and Hairline are int co

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-23 19:13

    In Swift you can use type double for enums

    enum Constants: Double {
        case π = 3.14159
        case e = 2.71828
        case φ = 1.61803398874
        case λ = 1.30357
    }
    

    To know much about practical usage of enums in swift please refer https://appventure.me/2015/10/17/advanced-practical-enum-examples/

提交回复
热议问题