It is listed on the release notes for Xcode 13 Beta 3 that it was a bug in the compiler that allowed this to occur.
This is an excerpt:
The compiler used to erroneously accept @available annotations on enum
cases with associated values that were newer than the deployment
target. (80238318)
For example:
@available(macOS 12, *)
public struct Crayon {}
public enum Pen {
case pencil
@available(macOS 12, *)
case crayon(Crayon)
}
While this worked in some cases, there was no way for the Swift
runtime to perform the requisite dynamic layout needed in general, so
this could cause crashes at runtime. The compiler now rejects such
availability newer than the deployment target on enum cases.
So although you could do it before, you cannot do it now as the compiler cannot perform the checks that it required.
Either you can mark the whole enum as @available
. But a solution, without knowing the full context may be difficult to come by.