Skip to content

Commit

Permalink
Add updated WKWebView Inspectable flag (#14610)
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Apr 17, 2023
1 parent f939049 commit be08715
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/BlazorWebView/src/Maui/iOS/BlazorWebViewHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ protected override WKWebView CreatePlatformView()
Configuration = config
});

// Legacy Developer Extras setting.
config.Preferences.SetValueForKey(NSObject.FromObject(DeveloperTools.Enabled), new NSString("developerExtrasEnabled"));

config.UserContentController.AddScriptMessageHandler(new WebViewScriptMessageHandler(MessageReceived), "webwindowinterop");
Expand All @@ -94,6 +95,10 @@ protected override WKWebView CreatePlatformView()
AutosizesSubviews = true
};

#if MACCATALYST13_3_OR_GREATER || IOS16_4_OR_GREATER
// Enable Developer Extras for Catalyst/iOS builds for 16.4+
webview.SetValueForKey(NSObject.FromObject(DeveloperTools.Enabled), new NSString("inspectable"));
#endif
VirtualView.BlazorWebViewInitialized(new BlazorWebViewInitializedEventArgs
{
WebView = webview
Expand Down

0 comments on commit be08715

Please sign in to comment.