-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift Package will not build in Xcode 13 (beta 3+) #31
Comments
thank for the report |
I case it helps, I hacked around the issue temporarily by editing the sources in the That works perfectly for my own use since I'm just linking this with a main app target, but I would imagine you may want to make the annotations more fine-grained so that only specific functionality/methods are unavailable in extensions, rather than the whole package :) |
Hi, seems like Apple eventually decided to fix this issue with SPM, so the hack above is no longer needed on the latest Xcode 13 betas. I will close this issue now. |
First off, thank you for this excellent package and the amount of ease and sanity it introduces when handling callback URLs!
It seems that either Apple or the Swift project made a breaking change in the latest Xcode beta release which affects CallbackURLKit. The change is documented here: https://forums.swift.org/t/set-application-extension-api-only-on-a-spm-package/39333/11
In short, it means that when compiling a Swift Package, it no longer matters if a main app or an extension is being targeted, but instead the code itself needs to declare whether a method is available for extensions or not, on top of everything else. In CallbackURLKit, this breaks at the point where the code tries to use
UIApplication.shared.open(url: ...)
. While I and I'm sure many others probably think of this change as a bit reckless, it may be something that the code in the package needs to deal with.The solution, thankfully, is relatively simple. The code needs to have the annotation
@available(iOSApplicationExtension, unavailable)
around any method that cannot be called from an app extension. In the case of CallbackURLKit, it would just involve "babushka"ing that annotation on the method that opens URLs and the methods that use it in turn.Please also see the discussion in the Apple Dev Forums here for reference: https://developer.apple.com/forums/thread/685103
I hope this is of some help. Thank you once again for the brilliant and super-useful package.
The text was updated successfully, but these errors were encountered: