I am getting an error message with Xcode 13 on the following code
@available(iOS 13.0, *)
case windowScene(_: UIWindowScene, windowLevel: UIWindow.Level)
Enum cases with associated values cannot be marked potentially unavailable with '@available'
Does anyone know why I'm getting this error and what is the solution to rectify it? It was working fine in Xcode 12.
See this Swift bug for an explanation and workaround from the Swift compiler team.
This is intentional. The ABI of enum cases with payloads that are potentially unavailable is not well-defined. That this worked in the past was by coincidence of your application not requiring the (potentially unavailable) type metadata for the payload. Please either increase your deployment target or mark Foo itself as available as the least-available case. https://github.com/apple/swift/pull/36327
So you either need to mark the whole enum as @available(iOS 13.0, *)
or need to increase your deployment target to iOS 13.0
.
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