Constructors accept base interface instead of concrete type
The constructors of the following types now accept the base interface (IWebViewHandler
) instead of a specific, concrete type that implements the interface (WebViewHandler
):
Microsoft.Maui.Platform.MauiWebChromeClient
Microsoft.Maui.Platform.MauiWebViewNavigationDelegate
Version introduced
.NET 7
Previous behavior
The constructors of MauiWebChromeClient
and MauiWebViewNavigationDelegate
required the caller to pass in a concrete Microsoft.Maui.Handlers.WebViewHandler
instance.
New behavior
The constructors of MauiWebChromeClient
and MauiWebViewNavigationDelegate
now accept any implementation of the interface Microsoft.Maui.Handlers.IWebViewHandler
.
Type of breaking change
This change can affect binary compatibility.
Reason for change
The original constructors required the caller to pass in a concrete type that's not user-controllable and could throw at any point depending on the library author or order of imports. The new implementation just requires the base interface, which is something a developer can actually use.
Recommended action
- If you've overridden the
WKUIDelegate
mapper for the iOS or Mac CatalystWebViewHandler
, multi-targetnet6.0-ios
andnet7.0-ios
ornet6.0-maccatalyst
andnet7.0-maccatalyst
. - If you've overridden the
WebChromeClient
mapper for the AndroidWebViewHandler
, multi-targetnet6.0-android
andnet7.0-android
. - Otherwise, no action is necessary.
Affected APIs
Microsoft.Maui.Platform.MauiWebChromeClient
constructorMicrosoft.Maui.Platform.MauiWebViewNavigationDelegate
constructor