-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Make WkWebViewRenderer default for iOS WebView #7367
Conversation
I thought the OP said he was already using |
I think that is something we need to investigate. I also see some reports of people implementing a renderer with Removing the old renderer altogether is not something that I would want to do. That will immediately break peoples code whenever they have any reference whatsoever to that class. If there is no reference to it, it should be removed by the compiler and all should be good. |
I ran some tests with this and it is not removed. If you run a default iOS app currently with full linker on even the WkWebViewRenderer sticks around if you aren't using it. The intent of the RenderWith attributes was to link anything out for elements you didn't use but I don't think that behavior is currently working correctly. So I don't think this PR will really achieve anything currently |
So, what now? Fix the linker behavior or introduce a breaking change and remove the old renderer? |
My current thought would be to figure out why those renderers aren't getting linked out (which I've been working on a bit). If RenderWith isn't resulting in Renderers being linked out then I don't think it and the whole Forwarders thing serves any purpose (right?) In that case we could switch the default type (like in this PR) and then leave the WebViewRenderer in. If people need to revert back to WebViewRenderer they can add the Export for it but if people aren't using it then hopefully it gets linked out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need doc on how to revert to original behavior. no need for a blog post, but a few lines in the PR description
@jfversluis can you rebase to master? I just merged 4.3.0 up so we should be able to get this through the UI tests In theory for this change to get rid of the warning we also have to delete this out of the AssemblyInfo Though that currently does nothing (as we know and bug logged with iOS) So we might want to include deleting that as part of this PR and working through whatever needs to be worked through with the linker to make sure our code still works. |
@jfversluis never mind about removing The WebViewRenderer will never get linked out no matter how much it wants to. |
Short summary: there is no way to get the (UI)WebViewRenderer linked out through the mechanism we have in place. As a first step to swap out the WebViewRenderer and WkWebViewRenderer we would merge this PR. People submitting apps to Apple will still receive the warning, but it's just that: a warning. Probably by the time iOS 14 starts knocking on the door Apple will start actually rejecting apps still referencing UIWebView. Because we can't link out the (UI)WebViewRenderer, we need to delete it as a whole. This will be a breaking change for everyone still referencing it. In a follow up PR somewhere in the future we will need to do this or come up with something better. For now, this is the solution to at least warn our users that they should start removing references to this renderer. |
@PureWeen @jfversluis For those of us who want to remove the old renderer completely, you could fix #5815 so that we could use Azure DevOps for custom builds. Right now, I use cake to build locally, but I'd rather integrate with DevOps. This page needs to be updated to remove VSTS: https://github.com/xamarin/Xamarin.Forms/wiki/How-to-Build-Xamarin.Forms-NuGet #3430 was fixed, but this was ignored. |
@adrianknight89 working on that over here Once I have it to a point where there's a path that the public can use I'll let you know and you can let me know how it works out for you |
Thanks Shane! |
Fixed the tests for iOS. It seems UITest also has some issues with UIWebView -> WKWebView. I will report that to them. Namely:
|
4b5c106
to
7cab6da
Compare
Failed tests are not related (CarouselView one) |
* Make WkWebViewRenderer default for iOS * Update AssemblyInfo.cs * Update Xamarin.Forms.Platform.cs * Revert "Update AssemblyInfo.cs" This reverts commit ca0c034. * Fix test 26993 iOS * Update Bugzilla26993.cs
* Make WkWebViewRenderer default for iOS * Update AssemblyInfo.cs * Update Xamarin.Forms.Platform.cs * Revert "Update AssemblyInfo.cs" This reverts commit ca0c034. * Fix test 26993 iOS * Update Bugzilla26993.cs
Description of Change
Deprecates the
WebViewRenderer
for iOS and uses theWkWebViewRenderer
instead.No (extra) automated tests were added at this stage, the ones in place should succeeded with this replacement.
To reinstate the current behavior just add the line below to the
AssemblyInfo.cs
file of you iOS project. This will register theWebViewRenderer
again over theWkWebViewRenderer
.[assembly: ExportRenderer(typeof(Xamarin.Forms.WebView), typeof(Xamarin.Forms.Platform.iOS.WebViewRenderer))]
Issues Resolved
API Changes
None
Platforms Affected
Behavioral/Visual Changes
None. Everything should function as before. Users should receive build warnings when they reference the
WebViewRenderer
directly. E.g. when there is a custom renderer in place.Before/After Screenshots
Not applicable
Testing Procedure
PR Checklist