In my Swift native module for react-native I am trying to export to javascript a Swift enum:
@objc(InterfaceOrientationManager)
class InterfaceOrientationManager: NSObject {
enum InterfaceOrientation: String {
case landscapeRight
case landscapeLeft
case portrait
case portraitUpsideDown
}
@objc
static func requiresMainQueueSetup() -> Bool {
return true
}
@objc
func constantsToExport() -> [String: Any]! {
return [
"InterfaceOrientation": InterfaceOrientation
]
}
However this isn't working I get the error "Expected member name or constructor call after type name". A screenshot is at bottom.
Is there any way to accomplish this? I was hoping to avoid doing a dictionary:
let InterfaceOrientation: [String: String] = [
"landscapeRight": "landscapeRight",
"landscapeLeft": "landscapeLeft",
"portrait": "portrait",
"portraitUpsideDown": "portraitUpsideDown"
]