How to reference Swift enum in Objective-C Header

前端 未结 7 2241
星月不相逢
星月不相逢 2021-01-31 19:38

Is there a way to reference a Swift enum from an Objective-C header? If you want to see Swift classes in the Objective-C header you can use

@objc class Foo
         


        
7条回答
  •  天命终不由人
    2021-01-31 20:14

    I just use NSInteger as return type for both header and implementation files. And when you need to use the enum, get the enum by let yourEnum = YourEnum(rawValue: Int(enumNSInteger)). This works for me.

提交回复
热议问题