SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.32k stars 746 forks source link

Xcode 13 beta 3 - SwiftPM - Build error: UIApplication.shared not available in iOS App Extension #475

Closed klanchman closed 3 years ago

klanchman commented 3 years ago

When building an app with SwiftMessages from Swift Package Manager in Xcode 13 beta 3 that does not use app extensions, compiler errors related to API availability in app extensions are emitted.

Reproduction Steps

Result: multiple errors on UIApplication.shared usage:

'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.

Other Notes

This appears to be expected behavior in Xcode 13 beta 3 with Swift Package Manager, based on this Apple Developer Forums thread and this Swift forums post. The Apple engineer in the second link recommends dealing with this by marking declarations as unavailable to app extensions when they use APIs that are unavailable to app extensions.


Update: It looks like the Swift team is reconsidering how this behaves. I'll update this issue as we hear more from them.

sofili commented 3 years ago

having the same issues

klanchman commented 3 years ago

Apple reverted this change in Xcode 13 beta 5, these errors no longer occur.

wtmoose commented 3 years ago

Whew. Thanks for keeping tabs on this