`@StateMachineHashable` macro does not account for access control
For example, if used on a public enum, it will generate internal enum HashableIdentifier and internal vars hashableIdentifier and associatedValue. This fails to compile.
Solution for Problem #61 The code generation template is producing internal declarations for types and members that are associated with public enums. This creates an accessibility level mismatch where public clients attempt to access internal implementation details, violating Swift's access control rules. Apply the @usableFromInline attribute to the internally generated types and members.
public enum YourPublicEnum {
case caseOne(String)
case caseTwo(Int)
}
@usableFromInline
internal enum HashableIdentifier {
case caseOne
case caseTwo
}
public extension YourPublicEnum {
@usableFromInline
internal var hashableIdentifier: HashableIdentifier {
switch self {
case .caseOne: return .caseOne
case .caseTwo: return .caseTwo
}
}
@usableFromInline
internal var associatedValue: Any? {
// your code
}
}
I can provide the working code fix ready to merge. Just share the code that's causing the issue, and I'll implement the proper @usableFromInline solution directly. 😊