Linking Swift Package from the main application emits error about linking to APIs not safe for use in application extensions

Originator:konstantin
Number:rdar://FB9332199 Date Originated:15/07/2021
Status:Closed Resolved:16/07/2021
Product:Xcode Product Version:13A5192i
Classification: Reproducible:yes
 
Linking Swift Package from the main application emits error about linking to APIs not safe for use in application extensions.

Xcode 13 beta 3 reports an error when a Swift Package added as a library to the main application uses APIs annotated as unsafe for use in application extensions.

Comments

Apple Feedback

This is expected; you must either annotate methods using unavailable app extension APIs as @available(iOSApplicationExtension, unavailable), or in this specific case, use view controller based solutions instead, such as changing:

guard let orientation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation else { return }

To:

guard let orientation = view.window?.windowScene?.interfaceOrientation else { return }
By konstantin at July 19, 2021, 1:16 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!