Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i use WKWebView instead of UIWebView in Xamarin Forms WebView(iOS)

I'm working on mobile application development using Xamarin.Forms (PCL). I am using Xamarin WebView to render some web view contents and i'm getting performance issue in iOS application. So, i have analyzed and found that the WKWebView will improve the performance.

How can i use WKWebView in Xamarin Forms WebView instead of UIWebView ? Is there any custom rendering available to do this?

like image 705
Karthik Avatar asked Feb 28 '17 08:02

Karthik


1 Answers

Yes, You can create custom renderer using WKWebView.

Please have a look below and this is ios renderer class of WebView:

[assembly: ExportRenderer(typeof(CustomWebView), typeof(CustomWebViewRenderer))]
namespace DemoApp.iOS.Renderers
{
    public class CustomWebViewRenderer : ViewRenderer<CustomWebView, WKWebView>
    {
        protected override void OnElementChanged(ElementChangedEventArgs<CustomWebView> e)
        {
            base.OnElementChanged(e);
        }
    }
}

for more information click here .

like image 127
Pavan V Parekh Avatar answered Oct 19 '22 17:10

Pavan V Parekh