[Regression][Xcode 13.0b3]: a normal target in a linked SwiftPM library is treated as an app extension

Feedback ID: FB9337463

Hello,

When compiling our application, I see the following problem reproduced with the attached sample example (modified the following repository sample as the problem happens in this library: https://github.com/ephread/Instructions.git ):

$HOME/Library/Developer/Xcode/DerivedData/Instructions_Example-hhbleavuawdnqpbogvbuddnqmepj/SourcePackages/checkouts/Instructions/Sources/Instructions/Core/Public/CoachMarksController.swift:215:48: error: 'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.
            if let windowScene = UIApplication.shared.activeScene {

Note that this was not happening in our app or this sample project with Xcode 13.0 beta 2, it started happening today when I updated to Xcode 13.0 beta 3).

Thank you in advance for your help :)!

Kind Regards,

Goffredo Marocchi

Sample projects (archive): https://www.icloud.com/iclouddrive/0rc9JcVxDKFF6I8hfzZ7_6KLQ#SampleIssue%5FProj

Kind Regards,

Goffredo

  • Also experiencing this issue, no extensions in our app and the error is in a couple of dependencies. Anyone have a workaround that doesn't involve forking the dependencies?

  • I think it is a SwiftPM change. Integrating the library through CocoaPods solves the problem here and passes it down to the next library integrated through SwiftPM.

  • Also experiencing this. Earlier today I also filed a radar ID FB9334019 with a sample project (nothing complex, all that’s needed is to make a new project in Xcode and add a Swift Package dependency that references UIApplication.shared). Would love to know if there’s a workaround (aside from using Cocoapods I guess :))

Accepted Reply

The change has been reverted in SwiftPM (Xcode 13 beta 5 for sure) so now this problem should not affect apps and libraries anymore (although some libraries like Firebase had already adapted successfully to it)

Replies

The change has been reverted in SwiftPM (Xcode 13 beta 5 for sure) so now this problem should not affect apps and libraries anymore (although some libraries like Firebase had already adapted successfully to it)