Skip to content

[webview_flutter_wkwebview] Swift formatting incorrect with Xcode 26 beta 4 #172983

@vashworth

Description

@vashworth

Formatting failing when testing Xcode 26 beta 4:

https://ci.chromium.org/ui/p/flutter/builders/try/Mac_arm64%20macos_repo_checks/9463/overview

These files are not formatted correctly (see diff below):
  packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift
  packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift
  packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift

To fix run the repository tooling `format` command: https://github.com/flutter/packages/blob/main/script/tool/README.md#format-code
or copy-paste this command into your terminal:
patch -p1 <<DONE
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift
index df7748642..01b4aff2a 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift
+++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift
@@ -170,11 +170,12 @@ class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate {
   func decidePolicyForNavigationAction(
     pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView,
     navigationAction navigationActionArg: WKNavigationAction,
-    completion: @escaping (
-      Result<
-        webview_flutter_wkwebview.NavigationActionPolicy, webview_flutter_wkwebview.PigeonError
-      >
-    ) -> Void
+    completion:
+      @escaping (
+        Result<
+          webview_flutter_wkwebview.NavigationActionPolicy, webview_flutter_wkwebview.PigeonError
+        >
+      ) -> Void
   ) {
     decidePolicyForNavigationActionArgs = [webViewArg, navigationActionArg]
     completion(.success(.allow))
@@ -183,11 +184,12 @@ class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate {
   func decidePolicyForNavigationResponse(
     pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView,
     navigationResponse navigationResponseArg: WKNavigationResponse,
-    completion: @escaping (
-      Result<
-        webview_flutter_wkwebview.NavigationResponsePolicy, webview_flutter_wkwebview.PigeonError
-      >
-    ) -> Void
+    completion:
+      @escaping (
+        Result<
+          webview_flutter_wkwebview.NavigationResponsePolicy, webview_flutter_wkwebview.PigeonError
+        >
+      ) -> Void
   ) {
     decidePolicyForNavigationResponseArgs = [webViewArg, navigationResponseArg]
     completion(.success(.cancel))
@@ -219,12 +221,13 @@ class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate {
   func didReceiveAuthenticationChallenge(
     pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView,
     challenge challengeArg: URLAuthenticationChallenge,
-    completion: @escaping (
-      Result<
-        webview_flutter_wkwebview.AuthenticationChallengeResponse,
-        webview_flutter_wkwebview.PigeonError
-      >
-    ) -> Void
+    completion:
+      @escaping (
+        Result<
+          webview_flutter_wkwebview.AuthenticationChallengeResponse,
+          webview_flutter_wkwebview.PigeonError
+        >
+      ) -> Void
   ) {
     didReceiveAuthenticationChallengeArgs = [webViewArg, challengeArg]
     completion(
@@ -241,7 +244,8 @@ class TestWebView: WKWebView {
   }
 }
 
-class TestURLAuthenticationChallengeSender: NSObject, URLAuthenticationChallengeSender, @unchecked
+class TestURLAuthenticationChallengeSender: NSObject, URLAuthenticationChallengeSender,
+  @unchecked
   Sendable
 {
   func use(_ credential: URLCredential, for challenge: URLAuthenticationChallenge) {
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift
index 4988bb602..e30d9bb74 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift
+++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift
@@ -233,7 +233,8 @@ public class NavigationDelegateImpl: NSObject, WKNavigationDelegate {
   #if compiler(>=6.0)
     public func webView(
       _ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge,
-      completionHandler: @escaping @MainActor (URLSession.AuthChallengeDisposition, URLCredential?)
+      completionHandler:
+        @escaping @MainActor (URLSession.AuthChallengeDisposition, URLCredential?)
         ->
         Void
     ) {
@@ -256,7 +257,8 @@ public class NavigationDelegateImpl: NSObject, WKNavigationDelegate {
   #else
     public func webView(
       _ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge,
-      completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) ->
+      completionHandler:
+        @escaping (URLSession.AuthChallengeDisposition, URLCredential?) ->
         Void
     ) {
       registrar.dispatchOnMainThread { onFailure in
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift
index 51de764a6..5c6257173 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift
+++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift
@@ -78,9 +78,10 @@ open class ProxyAPIRegistrar: WebKitLibraryPigeonProxyApiRegistrar {
 
   /// Handles calling a Flutter method on the main thread.
   func dispatchOnMainThread(
-    execute work: @escaping (
-      _ onFailure: @escaping (_ methodName: String, _ error: PigeonError) -> Void
-    ) -> Void
+    execute work:
+      @escaping (
+        _ onFailure: @escaping (_ methodName: String, _ error: PigeonError) -> Void
+      ) -> Void
   ) {
     DispatchQueue.main.async {
       work { methodName, error in

DONE

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: pluginsSupport for writing, building, and running plugin packagesp: webviewThe WebView pluginplatform-iosiOS applications specificallyplatform-macBuilding on or for macOS specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions