freshOS / KeyboardLayoutGuide

⌨️ KeyboardLayoutGuide, back from when it didn't exist.
MIT License
1.19k stars 59 forks source link

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

Closed klanchman closed 3 years ago

klanchman commented 3 years ago

When building an app with KeyboardLayoutGuide 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.

klanchman commented 3 years ago

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