using System.Runtime.InteropServices; using Xamarin.Essentials; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; using XamarinApp.iOS; [assembly: ExportRenderer(typeof(WebView), typeof(CustomWebViewRenderer))] namespace XamarinApp.iOS { public class CustomWebViewRenderer : WkWebViewRenderer { protected override void OnElementChanged(VisualElementChangedEventArgs e) { base.OnElementChanged(e); if (e.NewElement != null) { CustomUserAgent = $"{DeviceInfo.Manufacturer}~{DeviceInfo.Model}~{Device.RuntimePlatform}~{(Device.Idiom == TargetIdiom.Tablet ? "ipad" : "iphone")}"; } } } }