Interoperable Obj-C typedef NS_ENUM to swift

775 views Asked by At

In my Objective-C .h file, I have defined:

typedef NS_ENUM(NSInteger, RTSpinKitViewStyle) {
    RTSpinKitViewStylePlane,
    RTSpinKitViewStyleCircleFlip
};

How to access the enum in Swift code?

I tried using dot operator as RTSpinKitViewStyle.RTSpinKitViewStyleCircleFlip but it shows compile error

"RTSpinKitViewStyle.Type does not have member type name RTSpinKitViewStyleCircleFlip " .

2

There are 2 answers

2
Greg On BEST ANSWER

Use:

RTSpinKitViewStyle.CircleFlip

or just:

.CircleFlip
1
yashwanth77 On

You can access them as RTSpinKitViewStyle.Plane.