-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Warning suggests @preconcurrency import
but when added, there is a warning that @preconcurrency import
has no effect.
#74904
Comments
I am having this same issue! But when importing I'm using Xcode 16.0 Beta 2, on macOS 14.5 |
Thank you so much for posting this. I spent quite a lot of time trying to figure this one out, and wasn't able to discover your I submitted feedback about the circular warning issue to Apple as FB14066938. |
I noticed that with Xcode 16 beta 3 this protocol has been updated: optional func webView(
_ webView: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping @MainActor @Sendable (WKNavigationActionPolicy) -> Void
) Note that the |
I don't know if this is significant, but Xcode autocomplete does not include func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping @MainActor (WKNavigationActionPolicy) -> Void) {
// ...
} I do see |
I verified that these two warnings still occur in Xcode 16 beta 3, although it still goes away with just the |
My project also facing similar issue, if add the attribute @mainactor to the protocol am able to compile with xcode 16 beta. But if i compile the same project with xcode 15 build fails. Wanted to compile that project both xcode 16 and as well xcode 15. Someone can help me how to fix this? |
@chaitu-venky I think it's expected to fail with Xcode 15, because |
Actually we've been using extension BasicWebViewController: WKNavigationDelegate {
#if compiler(>=6.0)
open func webView(
_: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping @MainActor (WKNavigationActionPolicy) -> Void)
{
...
}
#else
open func webView(
_: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)
{
...
}
#endif |
oh good to know! |
The circular warnings problem still occurs in Xcode 16.1 beta 1. |
…ndability conformance diagnostic has been suppressed under minimal concurrency checking (resolves swiftlang#74904)
…protocol sendability conformance diagnostic has been suppressed under minimal concurrency checking (resolves swiftlang#74904)
…protocol sendability conformance diagnostic has been suppressed under minimal concurrency checking (resolves swiftlang#74904)
btw the fix for this will no longer produce the erroneous warning message under The desired diagnostic about matching the attributes in the signature of the function being overridden already is produced when using |
Description
When I compile a class that implements WKNavigationDelegate, I get a warning on the line with
import WebKit
:Add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'WebKit'
However, there are no Sendable-related warnings in the file.
When I add the
@preconcurrency
to theimport WebKit
statement, I get this warning:'@preconcurrency' attribute on module 'WebKit' has no effect
Eventually I determined that the
WKNavigationDelegate
methods were outdated for iOS 18, and I needed to add a@MainActor
attribute to a closure in one of the delegate methods.Reproduction
I created a new project using Xcode 16 beta 2, and then added this code as a new file.
When I add the
@preconcurrency
attribute, I get a different warning.I was able to fix the warnings by updating
webView(:decidePolicyFor:decisionHandler:)
method to match the iOS 18WKNavigationDelegate
API:Expected behavior
@preconcurrency
be added should not be emitted when there are no Sendable-related warnings in the file.WKNavigationDelegate
protocol:Environment
WebKitImportPreconcurrencyRepro (main)$ swiftc -version
swift-driver version: 1.110 Apple Swift version 6.0 (swiftlang-6.0.0.4.52 clang-1600.0.21.1.3)
Target: arm64-apple-macosx14.0
Additional information
No response
The text was updated successfully, but these errors were encountered: