SwiftMessages: Xcode 13 issue - Enum cases with associated values cannot be marked potentially unavailable with '@available'

When we try to build SwiftMessages with Xcode 13 beta, the following error is being thrown: Enum cases with associated values cannot be marked potentially unavailable with '@available' Screenshot 2021-06-08 at 12 01 40 PM

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 32
  • Comments: 28 (8 by maintainers)

Most upvoted comments

@rizwan95 9.0.4 released. Thanks!

@rizwan95 same issues in Xcode 13 RC too

A quick fix using case windowScene(_: Any, windowLevel: UIWindow.Level) is on branch work/9.0.4 for folks to try.

Version 10 will revert back to case windowScene(_: UIWindowScene, windowLevel: UIWindow.Level) and instead require iOS 13.

Looks like the issue is solved with Xcode 13 RC.

Any update on this?

I submitted PR to solve this issue. Please check it out!

https://github.com/SwiftKickMobile/SwiftMessages/pull/478

I’ll keep an eye on this. Hopefully, they’ll fix the bug!

Seems like a bug in Swift 5.5

https://bugs.swift.org/browse/SR-14539

Yeah, sorry for the brainfart. Removed it. Another passable solution would be

case windowScene(_: Any, windowLevel: UIWindow.Level)

and casting the associated value to UIWindowScene where needed (just one location in SwiftMessages.Config+Extensions.swift).

This does remove compile-time guarantee but requires no changes to applications and is the smallest change that could be made to fix it I believe. Dropping iOS 12 is certainly an option, but poses a problem for application developers where decisions regarding minimum targets are out of their hands.

@bogartpi the issue is fixed on branch 9.0.4. Does anyone know the released date of 9.0.4?

We tried the latest version and still saw the same issue. The quick fix mentioned by @wtmoose worked. I may have missed something here but why could you make that as the official fix? Also some apps still support iOS 12 so dropping iOS 12 is not desired.

LOL…I’m not sure his suggestion would qualify as a workaround.