Equality on Objective-C typedef enum in Swift

前端 未结 4 742
误落风尘
误落风尘 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:20

    Swift automatically maps Obj-C enums to its own style of enumName.caseName structure. For example, if the enum is named FBSessionState and there is the FBSessionStateOpen case, it will map as FBSessionState.Open in Swift.

    The == operator will work for comparing Swift enums.

提交回复
热议问题