Skip to content
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

Compiler error 'shared' is unavailable in application extensions for iOS with SPM and Xcode 13 beta 3 #331

Open
martinknabbe opened this issue Jul 16, 2021 · 1 comment

Comments

@martinknabbe
Copy link

Report

What did you do?

Integrating SkyFloatingLabelTextField version 4.0.0 with Swift Package Manager and Xcode 13 beta 3 (13A5192i).

What did you expect to happen?

Library compiles without errors.

What happened instead?

Compiler emits error 'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead. SkyFloatingLabelTextField.swift line 33

This error appears due to the changes in the linker mentioned in the Xcode release notes

Resolved in Xcode 13 Beta 3

Linking Swift packages from application extension targets or watchOS applications no longer emits unresolvable warnings about linking to libraries not safe for use in application extensions. This means that code referencing APIs annotated as unavailable for use in app extensions must now themselves be annotated as unavailable for use in application extensions, in order to allow that code to be used in both apps and app extensions. (66928265)

All libraries that use API marked as unavailable in iOS app extensions, such as UIApplication.shared, have to mark their code themself with @available(iOSApplicationExtension, unavailable) in Swift and NS_EXTENSION_UNAVAILABLE in Objective-C.

Environment

Xcode Version: 13 beta 3 (13A5192i)
SkyFloatingLabelTextField Version: 4.0.0
Deployment Target: iOS 11.4
Base SDK: 15.0
Method of Integration: Swift Package Manager

sofili pushed a commit to sofili/SkyFloatingLabelTextField that referenced this issue Jul 20, 2021
@martinknabbe
Copy link
Author

Not sure what the future plan is in SwiftPM, but this was reverted for now in Xcode 13 beta 5.

Swift Packages
Resolved in Xcode 13 Beta 5

You don’t need to annotate code as unavailable for use in application extensions if it references APIs annotated as unavailable for use in application extensions. This reverts a requirement that Xcode 13 Beta 3 introduced. (80615922) (FB9332020)

Thread with some more details:
https://forums.swift.org/t/set-application-extension-api-only-on-a-spm-package/39333/27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant