Equality on Objective-C typedef enum in Swift

前端 未结 4 736
误落风尘
误落风尘 2021-02-19 08:01

I\'m working with the Facebook Objective-C SDK in Swift and I\'m trying to compare an FBSessionState value with a value from the enum. However I get the compiler error:

4条回答
  •  难免孤独
    2021-02-19 08:13

    You could unwrap the enum and constants with '.value' to get the underlying integer, which should be switchable:

    switch x.value {
      case Foo.value:
    }
    

    Maybe this is a bug and apple fix it in future releases.

提交回复
热议问题