Skip to content

Commit 1541190

Browse files
Use runtime check for setting WKWebView inspectable flag (#16631)
* Use runtime check * Remove private * Add back line * Line endings? * Use System.OperatingSystem * Update src/BlazorWebView/src/Maui/iOS/BlazorWebViewHandler.iOS.cs Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com> --------- Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
1 parent f7bfdd0 commit 1541190

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎src/BlazorWebView/src/Maui/iOS/BlazorWebViewHandler.iOS.cs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ protected override WKWebView CreatePlatformView()
9595
AutosizesSubviews = true
9696
};
9797

98-
#if MACCATALYST13_3_OR_GREATER || IOS16_4_OR_GREATER
99-
// Enable Developer Extras for Catalyst/iOS builds for 16.4+
100-
webview.SetValueForKey(NSObject.FromObject(DeveloperTools.Enabled), new NSString("inspectable"));
101-
#endif
98+
if (OperatingSystem.IsIOSVersionAtLeast(16, 4) || OperatingSystem.IsMacCatalystVersionAtLeast(13, 3))
99+
{
100+
// Enable Developer Extras for Catalyst/iOS builds for 16.4+
101+
webview.SetValueForKey(NSObject.FromObject(DeveloperTools.Enabled), new NSString("inspectable"));
102+
}
103+
102104
VirtualView.BlazorWebViewInitialized(new BlazorWebViewInitializedEventArgs
103105
{
104106
WebView = webview

0 commit comments

Comments
 (0)