I have this NS_ENUM
called ObserveType
having two properties called Observe
and ObserveAll
. I can access the ObserveAll
property as you can see from the picture, but I can't access Observe
.
The NS_ENUM is in a header file of objective-C.
I know that changing Observe
to ObserveX
or ObserveXYZ
will work.
But how do I access Observe
without changing the name of the Observe
?
Notice that I have to access the Observe
on Swift.
In addition to answers above, I'd like to point out that you can give your Objective-C NS_ENUM a Swift name with NS_SWIFT_NAME
macro:
typedef NS_ENUM(NSUInteger, XYZAwesomeEnum) {
XYZAwesomeEnumA,
XYZAwesomeEnumB,
XYZAwesomeEnumC,
} NS_SWIFT_NAME(AwesomeEnum);
Use it later in Swift:
AwesomeEnum.a
Apple Developer: Renaming Objective-C APIs for Swift
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With