I am getting error while accessing internal enum values inside public enum
Code snippet
@objc public enum Sample1 : Int {
case valid
fileprivate static var upgradeStatus:[String: Sample1] = [
RawString.validValue.rawValue : .valid
]
}
internal enum RawString: String {
case validValue = "Invalid"
}
The error says
Enum 'RawString' is internal and cannot be referenced from a property initializer in a '@_fixed_layout' type
Looks like it is because of bridging @Objc but not able to fix the issue. I cannot remove @Objc as my code is used in Objective C project as well.
Could anyone please help me in resolving this issue.
P.S : Started observing this error once after I update to Xcode 10
You could convert upgradeStatus
to a static method, this will make your code compile:
fileprivate static func upgradeStatus() -> [String: Sample1] {
return [
RawString.validValue.rawValue : .valid
]
}